c# - Default code generated by my EF model has errors -
this kind of noob question, , bit embarassed have not been able figure out myself , knew transition linqtosql ef fraught nuances this.
basically did
1> create musicstore sql database using visual studio 2012 server explorer 1 table.
2> added new ado.net entity data model
edmx
, generated using wizard pointing database in step 1.
this gave me diagram of musicstore table. if change code generation strategy
in properties default
instead of none
, code generated in musicstoremodel.designer.cs
.
however, @ public musicstoreentities() : base("name=musicstoreentities", "musicstoreentities")
i has invalid arguments
.
what missing here? reference? appreciated.
public partial class musicstoreentities : objectcontext { #region constructors /// <summary> /// initializes new musicstoreentities object using connection string ///found in 'musicstoreentities' section of application ///configuration file. /// </summary> public musicstoreentities() : base("name=musicstoreentities", "musicstoreentities") { // getting compilation error @ line below this.contextoptions.lazyloadingenabled = true; oncontextcreated(); }
this design. please refer following link microsoft's official position: entity framework 5 code generation strategy set default causes errors on properties of entities.
(...) reason seeing these compile errors because re-enabling legacy code generation without disabling new t4 based code generation. means 2 sets of classes being generated. page provides details on how revert objectcontext code generation - http://msdn.microsoft.com/en-us/data/jj556581.
Comments
Post a Comment