Visual Studio code snippets for DevForce 2010 "Code First" can speed development of your entity models, reducing tedium and errors.
There are five code snippets:
cflistnavprop.snippet, shortcut "cfnav", emits a "list navigation" property returning a DevForce RelatedEntityList of entities. For example, a Customer entity might have an "Orders" list navigation property returning the customer's Orders.
cfrefnavprop.snippet, shortcut "cfref", emits a "reference navigation" property and a companion foreign key property. The navigation property returns a single entity. For example a "Customer" property that returns the parent Customer entity. A reference navigation property usually has a corresponding foreign key property; a "Customer" property of an Order probably should have a foreign key property named CustomerId.
cfentitymanager.snippet, shortcut "cfentitymanager", emits a custom EntityManager for your model. It consists mostly of standard constructors and the prototype of a query method. It produces a lot of inescapable boiler plate code that you'll probably need only once per application model.
cfentityqueryprop.snippet, shortcut "cfeq", emits an EntityQuery<T> property for a custom EntityManager. For example, to add a Customers query property, use this snippet to add "public EntityQuery<Customer> Customers {get; set;}" to your EntityManager.
cfdbsetproperty.snippet, shortcut "cfdbset", emits a DbSet<T> property for a custom DbContext. For example, to expose Customer entities, use this snippet to add "public DbSet<Customer> Customers {get; set;}" to your DbContext.
Unzip and find the snippets for your preferred language.
Copy the snippet files to a location where Visual Studio can find them such as:
"%USERPROFILE%\Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets" or
"%USERPROFILE%\Documents\Visual Studio 2010\Code Snippets\Visual Basic\My Code Snippets".
Microsoft describes numerous ways to use a code snippet. We prefer the "short-cut" technique: