c# - EF 4, how to add partial classes -


i needed extend ef partial classes, because want add functionality able use oracle's sequences , don't know how use partial class thing, made seperate .cs file , name 1 of auto-generated classes follows:

namespace glassstoredal {     public partial class car      {         private int _sequences;         public int sequences         {             { return _sequences; }             set { _sequences = value; }         }     }   } 

now assumed that, on bll - references glassstoredal - can find "sequences" property , apparently goes wrong, appreciate here.

here generated partial class , should have sequences property there?

[edmentitytypeattribute(namespacename="model", name="car")] [serializable()] [datacontractattribute(isreference=true)] public partial class car : entityobject {     #region factory method     /// <summary>     /// create new car object.     /// </summary>     /// <param name="id">initial value of id property.</param>     public static car createcar(global::system.decimal id)     {         car car = new car();         car.id = id;         return car;     }      #endregion     #region primitive properties      /// <summary>     /// no metadata documentation available.     /// </summary>     [edmscalarpropertyattribute(entitykeyproperty=true, isnullable=false)]     [datamemberattribute()]     public global::system.decimal id     {                 {             return _id;         }         set         {             if (_id != value)             {                 onidchanging(value);                 reportpropertychanging("id");                 _id = structuralobject.setvalidvalue(value);                 reportpropertychanged("id");                 onidchanged();             }         }     }      private global::system.decimal _id;     partial void onidchanging(global::system.decimal value);     partial void onidchanged();      /// <summary>     /// no metadata documentation available.     /// </summary>     [edmscalarpropertyattribute(entitykeyproperty=false, isnullable=true)]     [datamemberattribute()]     public global::system.string name     {                 {             return _name;         }         set         {             onnamechanging(value);             reportpropertychanging("name");             _name = structuralobject.setvalidvalue(value, true);             reportpropertychanged("name");             onnamechanged();         }     }      private global::system.string _name;     partial void onnamechanging(global::system.string value);     partial void onnamechanged();      /// <summary>     /// no metadata documentation available.     /// </summary>     [edmscalarpropertyattribute(entitykeyproperty=false, isnullable=true)]     [datamemberattribute()]     public global::system.string model     {                 {             return _model;         }         set         {             onmodelchanging(value);             reportpropertychanging("model");             _model = structuralobject.setvalidvalue(value, true);             reportpropertychanged("model");             onmodelchanged();         }     }      private global::system.string _model;     partial void onmodelchanging(global::system.string value);     partial void onmodelchanged();      #endregion      #region navigation properties      /// <summary>     /// no metadata documentation available.     /// </summary>     [xmlignoreattribute()]     [soapignoreattribute()]     [datamemberattribute()]     [edmrelationshipnavigationpropertyattribute("model",          "sys_c009618", "glass")]     public entitycollection<glass> glasses     {                 {             return ((ientitywithrelationships)this).relationshipmanager.                 getrelatedcollection<glass>("model.sys_c009618", "glass");         }         set         {             if ((value != null))             {                 ((ientitywithrelationships)this).relationshipmanager.                     initializerelatedcollection<glass>("model.sys_c009618",                          "glass", value);             }         }     }      #endregion } 

to summarise large comment trail...

check partials being attached correctly:

  • make sure both class definitions in same namespace , assembly.
  • make sure @ least 1 of them declared partial (most generated classes are, including ef generated ones).
  • check make sure newly created partial can see previous members, confirm partials match up.

where client in different binary (which case here)

  • make sure client projects binary/references date (perform clean build / delete binary copy / recreate reference), depending upon project situation.

for case, last check important , solved problem.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -