
subsonicproject - issue #103
ActiveRecord(T4) methods Find & SingleOrDefault with multiple connectionStrings
What steps will reproduce the problem? 1.Generate datebase using ActiveRecord T4 templates. 2.Call Method: ModelName.Find(m=>m.ModelID) or SingleOrDefault (m=>m.ModelID); 3.DbDataProvider throws exception What is the expected output? What do you see instead? Datebase Records. See exception instead....
What version of the product are you using? On what operating system? VS2008 on Windows 7 RC
Descrition: In ActiveRecord.cs(Generate from T4 temp) Methods: public static Customer SingleOrDefault(Expression<Func<Product, bool>> expression) public static IList<Customer> Find(Expression<Func<Product, bool>> expression)
I will explain one of these two methods,they have the same issue;
In SingleOrDefault, the problem is here "var qry=new SubSonic.Query.Select().From<Product>();" "Select()" does not specify a provider; the provider will be ProviderFactory.GetProvider() which will get first ConnectionString in Web.config and Provider "ConfigurationManager.ConnectionStrings [ConfigurationManager.ConnectionStrings.Count - 1]" If we are not using FIRST ConnectionString listed in Web.config An Exception will throw;
Comment #1
Posted on Jun 20, 2009 by Happy HorseSorry,this issue is for subsonicthree ,different from this
Status: New
Labels:
Type-Defect
Priority-Medium