Entity Framework from scratch

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 13 años
Hi,

I would like to know how nopCommerce team have generated the classes (POCOs?) and Contexts on their own structure of namespaces...there's any manual work? I am asking because examples I saw generated these classes under a .tt file or as partial classes under the .Designer.cs of the model file, and I could not find any of those in the solution and we are thinking about modeling the introduction of new entities.

Thanks
Hace 13 años
They are hand-crafted
Hace 13 años
Thanks for the reply.

So it means that EntityType attribute of NopModel.edmx is also hand-crafted?
I imagine that at first time, you generated the classes from database and then disabled the automatic generation, or something like this?
Hace 13 años
Another question, to complement the last one: what when you need to add a new attribute to some entity? You add the column to database (if needed), synchronize the model with database and than manually adds the new attribute (property) to the entity?
Hace 13 años
carrbrpoa wrote:
I imagine that at first time, you generated the classes from database and then disabled the automatic generation, or something like this?

All of them were hand-crafted (previously we didn't use EF, and they already existed)

carrbrpoa wrote:
what when you need to add a new attribute to some entity? You add the column to database (if needed), synchronize the model with database and than manually adds the new attribute (property) to the entity?

Correct
Hace 13 años
Thanks, it cleared my initial doubts. Resolved!
Hace 12 años
I am not sure why but i am getting this error on adding a new entity ProductSubtopic
exc = {"The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type 'NopSolutions.NopCommerce.BusinessLogic.ProductTopics.ProductSubtopic'."}

I added another entity following the same steps it works fine, please help me out i am new at this
Hace 12 años
hemant wrote:
I am not sure why but i am getting this error on adding a new entity ProductSubtopic
exc = {"The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type 'NopSolutions.NopCommerce.BusinessLogic.ProductTopics.ProductSubtopic'."}

I added another entity following the same steps it works fine, please help me out i am new at this


This happens at entry = context.ObjectStateManager.GetObjectStateEntry(entity); in  class Extensions.cs

Method isAttached
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.