Archive for the ‘MS .NET’ Category

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…


How to Make a Text Box as Read-Only or Disabled in MVC4

It’s pretty common requirement for a developer to make a text box as Read-Only or completely Disable it in an application, whether it’s ASP.NET web page or MVC view or any other technology. It’s a kind of user interface’s requirement.

For example, user must not be able to update/delete a Customer ID or Product ID when we’re populating details into Edit view or Details view on a web page. So, how to implement this in MVC4?

Lets say we are having a simple CustomerModel class as shown in below image.


Read more…

Best Book for WCF Beginners

I recommend this book if you are absolute beginner for WCF. I’ve gone through many books on WCF but I find this one the best for beginners. It’s 4.5 version out there. ‪#‎WCF‬ ‪#‎MikeLiu


Tags: ,

M# Programming Language, a Step Ahead to C#

It’s awesome!!! I tried M# programming language today and believe me, it’s faster…really  faster. I’m not sure about technical advantages over C#, but, of course, the development is much faster with it.

Earlier, I thought it’s going to compete with the C#, but I realized it’s a companion to C# and ASP.NET. Microsoft is still working on this M# project. But, let’s start learning it now. Take a look at the first screen that we come across when we start M# Explorer. Yes. It’s M# IDE is browser based. Isn’t it awesome!!!


Try it on you own. Best of luck!


Shortcut Keys for Try…Catch Block in C#

Wow!!! It amazing. I used to type Try…Catch block all the time. So, I thought Visual Studio must be having some shortcut keys for this. And to my surprise, it did have one Ctrl + K, Ctrl + S, it would show you a drop down list, type T and press Enter button…Boom!!! You got it. Take a look at below image…

My friends Abhijit Jhana and Shivprasad Koirala suggested type Try and press Tab twice. It works!!! And believer me, better than that I suggested above…


Tags: ,

Microsoft Press eBook: Programming Windows Store Apps 2nd Edition

This is really a good book on HTML 5, CSS and JavaScript to develop Windows Store Apps…Click here to download it for free…Hurry!!!



Free Wrox Ebook Professional WPF with C# and .NET 4.5

Wrox publication is giving free ebooks??? I couldn’t believe it. But, I downloaded the book and found really good. Though, I though it covers only WPF and C# but to my surprise, it covers various technologies using C# 4.5 and many new techniques. I really recommend you to download and take a look at. Click here to download it…



Tags: ,