Reputation: 17101
I'm hoping to scaffold a bunch of web forms pages using asp.net dynamic data. The tutorials fit in nicely when going directly into Entity Framework. However we are using generic repositories (to provide a multi tenancy layer), does anyone have any examples of how a repository pattern can work with dynamic data?
Upvotes: 1
Views: 279
Reputation: 9911
I'm doing Linq to SQL with a Repository pattern, and EF with repository pattern is possible also.
public class BaseRepository : IDisposable
{
protected MyDataContext dc = null;
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
protected BaseRepository()
{
dc = new MyDataContext(System.Configuration.ConfigurationManager.ConnectionStrings["My_ConnectionString"].ConnectionString, mappingSource);
}
}
I have an interface to my Object Repository :
interface IObjectRepository
{
...
}
and the object Repository:
public class ObjectRepository : BaseRepository, IObjectRepository
{
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public ObjectRepository()
{
IList<Foo> GetFoos = GetFoos()
{
...
}
}
}
Upvotes: 1