Linq To Sql: Dynamic Where Clause

Dynamic where clause using Linq To SQL: Let’s say we need to implement a search method with the following signature: IEnumerable FindCustomers(string name,string contactName,string city) If the requirement is that you should be able to pass zero to three arguments to this method and only apply a “where” criteria for the arguments that are not null. Then we can…More

Two flavors of DDD

I have been trying to practice domain driven design for the last few years. During this time, I have learnt that there are almost as many ways to implement DDD as there are practitioners. After studying a lot of different implementations I have seen two distinct patterns. I call the first pattern “Aggregate Graph”: When…More

Composite Oriented Programming: QI4J running on .NET

For the last month I have been spending my spare time porting the awesome Java framework QI4J to .NET. QI4J is the brain child of Rickard Öberg and Niclas Hedhman and it attempts to enable Composite Oriented Programming for the Java platform. (For more info regarding Composite Oriented Programming see the QI4J website: http://www.qi4j.org/ ) I’m well…More

Entity Framework 4 – Where Entity.Id in Array

Here is a little trick if you want to issue a query to the database and select a batch of entities by ID only: This will make Entity Framework issue an SQL query with the where clause “where customerId in (1,2,3)”, and thus, you can batch select specific entities with a single query. I will…More

Entity Framework 4 – Immutable Value Objects

Ok, the title is not quire accurate, I’m not aware of any way to accomplish truly immutable types for Entity Framework. However, this is a quite nice attempt IMO: This works very well with Entity Framework 4 and I think it is a fair compromise. //RogerMore