Archive

Archive for November, 2016

How and Where to Create Entity Class When ASP.NET MVC and Entity Framework Used

Thought about writing on topic as someone asked me this Question: “How and where to create Entity Class when we’re using both ASP.NET MVC and Entity Framework in the same project?”. Really, it’s been a topic discussed in the .NET Solutions Architects circle a lot. Let me explain the scenario why everyone gets confused when these technologies come into picture together, in the same project.

Let’s say we’re going to have multi-layered project architecture like UI Layer using ASP.NET MVC, Service Layer using Web APIs, Business Layer, Business Entities, Data Layer with Entity Framework plus other utility layers such as Exception Utility, etc.

The MVC project has got Model classes, which are used to derive Views. Most of the time, I would not say ALWAYS, the Model classes represent the entity like Customer, Employee, Transaction, Sales Invoice, etc.

Then we go and design our entity models in the Business Entities layer. These entity classes also represent same entity as MVC Model classes. There is a greater similarity between classes into these two layers.

Then comes our Service Layer like WCF or Web APIs. Again, either these layers have separate classes representing same entities as MVC or BE layers, or they use BEs classes as Data Models.

At last, the Entity Framework being used in the Data Layer. It also auto generates the classes which actually represent the database tables, and look very similar to the BE classes. So, we see now that almost every layer has got its own class representing the same entity.

Read more…

Advertisements

Visual C# .NET Training at Siemens, Bengaluru, 07 – 09 Nov, 2016

Finished Visual C# .NET training at Siemens, Bengaluru on 09 Nov, 2016. Enjoyed a lot teaching C# to Siemens guys. Good learners! We conducted this training at new Siemens office i.e. Salarpuria campus at Electronic City…Better training infrastructure.

09nov16siemens_pic