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…

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.


Visual C# .NET Training at Siemens, Electronic City, Bengaluru, 26 – 28 Oct, 2016

Today finished Visual C# .NET training at Siemens, Electronic City, Bengaluru. Very good and enthusiastic participants. Had nice time with them…:)


XML & Software Engineering Training at L&T Technology Services, Mysuru, 19 – 22 Oct, 2016

Finished XML & Software Engineering training at L&T Technology Services, Mysuru. Great and enthusiastic participants!


OOAD Using UML Training at L&T Technology Services, Mysuru, 23 – 25 July, 2016

Finished OOAD Using UML training at L&T Technology Services, Mysuru. I learn a lot about UML while teaching it. Enjoyed! Lots of Gujju participants in this batch 🙂


What is UniqueIdentifier in SQL Server

In simple words, the UniqueIdentifier is one of the data types that the SQL Server offers to the developers.

The question is What is does and Where we should use it? Yes, that’s very interesting.

The UniqueIdentifier is a data type which can contain a unique hexadecimal value up to 36 characters. More technically, it’s a 16-byte GUID.

We can either define a column or a variable with this data type. A column or local variable of UniqueIdentifier data type can be initialized to a value in the following ways:

  • By using the NEWID or NEWSEQUENTIALID function. It’s recommended you use NEWSEQUENTIALID function. I’m not gonna discuss why? All I can say is NEWSEQUENTIALID is faster than the NEWID due to its internal working.
  • By converting from a string constant in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, in which each x is a hexadecimal digit in the range 0-9 or a-f. For example, 6F9619FF-8B86-D011-B42D-00C04FC964FF is a valid UniqueIdentifier value.

Read more…

Blog place for NoSQL topics

Blog place for NoSQL topics