I\'m trying to use the Repository Pattern with EF4 using VS2010.
To this end I am using POCO code generation by right clicking on the entity model designer and click
For EF5 + DbContext generator: It's easy to move your Name.Context.tt to a different project. However, you will need to reference the model classes. You can do this manually, but this will require you to change it every time code gets generated. You could also use the same namespace for both projects. This is valid and will work, but I think this is bad design. Another alternative is to change the T4 template (Name.Context.tt).
Change this (line 43):
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
To this:
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (modelNamespace != codeNamespace)
#>
using <#=code.EscapeNamespace(modelNamespace)#>;
<#
if (container.FunctionImports.Any())
{
#>
This will check if your model namespace differs from your code namespace, if so, it will insert the required using to reference your model classes.