0

I have a base class and a few different subclasses set up to instantiate as change-tracking proxies, and I’d like to use the DbSet.Create(Type) method to create additional proxies to add to my Model.

My application was developed before Code First became available, so before, when I created these objects, I’d use a parameterized constructor to initialize both the object and its base member variables and properties.

Will Entity Framework allow me to create a change-tracking proxy using a constructor containing a parameter list? Would I be able to pass some of these parameters to the base class (proxy) as well? (I’d like to stick with the Object Oriented paradigm if I can because it’ll make the code easier to maintain.) If you can show me how to use parameterized constructors to do this, I’d be grateful.

Thanks,

4

1 回答 1

0

EF 不能使用参数化构造函数。您必须始终提供无参数构造函数(但不一定是public)。

于 2012-07-10T09:05:33.340 回答