C#: Predicates in LINQ to Entities

If you started programming MVC, in particular the Entity Framework Model, and find yourself filtering your data model using the Where<TSource>() method, you should know by now that you can chain this method instead of using the query syntax. // using query syntax - calling Where method oncecarQuery.Where(c => c.Color == 'red' && c.Price < …

Continue reading C#: Predicates in LINQ to Entities

Advertisements

ASP.NET: Beginner’s Resource on MVC 4, Entity Framework, and Razor

New to MVC 4/Entity Framework/Razor?  Then here are some links that are useful: Getting Started with EF 5 using MVC 4 Tutorial The tutorial above uses Code First to a New Database, meaning you create the EF model classes and generate the database.  But if you have an existing database, you can use Code First …

Continue reading ASP.NET: Beginner’s Resource on MVC 4, Entity Framework, and Razor

C#: Quick notes on some cool features…

… namely object initializer, collection initializer, implicitly typed local variable, anonymous type, anonymous method, and lambda expression.    Object Initializer // we have here an object we are going to initialize in some other classpublic class ToDoItem{ // the following are the auto-implemented or automatic properties public int ToDoItemID { get; set; } public string Description …

Continue reading C#: Quick notes on some cool features…

Design Patterns: Strategy, Observer, and Decorator

Here and in the next posts, I will talk about design patterns, it’s definition, the guiding design principles they embody, and their C# examples.  But before you dive into design patterns, here is a refresher on four OO basics.   Design Pattern #1: Strategy Pattern Defines a family of algorigthms, encapsulates each one, and makes …

Continue reading Design Patterns: Strategy, Observer, and Decorator

Design Patterns: The Four OO Basics

Before going into design patterns, one must need to know the four OO basics: Abstraction is showing only the necessary details to the outside world. It is the abstract form of anything. It is implemented using interface and abstract class. Encapsulation is hiding the details from the outside world. It is the opposite of abstraction. …

Continue reading Design Patterns: The Four OO Basics