asp.net dynamic dataを使用して、一連の Web フォーム ページを足場にしたいと考えています。チュートリアルは、Entity Framework を直接使用する場合にうまく適合します。ただし、(マルチテナンシー レイヤーを提供するために) 汎用リポジトリを使用していますが、リポジトリ パターンが動的データでどのように機能するかの例はありますか?
1 に答える
1
リポジトリ パターンを使用して Linq to SQL を実行していますが、リポジトリ パターンを使用した EF も可能です。
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()
{
...
}
}
}
于 2012-03-22T22:01:09.363 に答える