Presentation Planing

What gives the player the feeling that they are free to make their own choices and choose their own path regarding the direction of the story/game Agency is the ability to act in the world and feel…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Common mistakes when using Entity Framework

When using the entity framework to access your database there are a some traps you can fall into.

One trap is the tight coupling of your application to the Entity Framework, which violates the principle of abstracting away you underlying frameworks. I don’t think this principle always applies, but often it does. It depends…

The other trap is repeating the same query in your application, which violates the DRY principle. Say you have a user entity with the “IsActive” property to indicate that the user has not been disabled. Every time you query for users you would need to add the “.Where(user=>user.IsActive)” predicate to the query to make sure you only get active users. If change your definition of an active user, you would need to go into all queries using this predicate and update them.

By abstracting away queries and hiding the IQueryable interface behind a wrapper you can both decouple the framework from the rest of your application and avoid repeating queries.

Mosh Hamedani has a nice video on this

Add a comment

Related posts:

3 comparaciones entre 6 dibujos modelados.

En estos dos dibujos podemos observar una diferencia en cuanto a las líneas. Mientras que en el primer dibujo todas y cada una de ellas son iguales, en el segundo hay una jerarquía adecuada entre…

HOW TO BE YOUR SELF ALWAYS

Every living human be you male or female is entitled for one particular duty which is “Fighting for your own”but nowadays people find it very hard to depend on their self’s may be because of lack of…

How to write a script that performs certain commands in Linux

It is no news that the majority of software engineers use GNU/Linux operating systems or any other Unix-based operating system. Two common reasons that you will find for this trend are: For these…