Mercurial > pub > bltoolkit
diff Source/Data/Linq/DefaultDataContextInfo.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Source/Data/Linq/DefaultDataContextInfo.cs Thu Mar 27 21:46:09 2014 +0400 @@ -0,0 +1,30 @@ +using System; + +namespace BLToolkit.Data.Linq +{ + using Data.Sql.SqlProvider; + using DataProvider; + using Mapping; + + class DefaultDataContextInfo : IDataContextInfo + { + private IDataContext _dataContext; + public IDataContext DataContext { get { return _dataContext ?? (_dataContext = new DbManager()); } } + + public MappingSchema MappingSchema { get { return Map.DefaultSchema; } } + public bool DisposeContext { get { return true; } } + public string ContextID { get { return _dataProvider.Name; } } + + public ISqlProvider CreateSqlProvider() + { + return _dataProvider.CreateSqlProvider(); + } + + public IDataContextInfo Clone(bool forNestedQuery) + { + return new DataContextInfo(DataContext.Clone(forNestedQuery)); + } + + static readonly DataProviderBase _dataProvider = DbManager.GetDataProvider(DbManager.DefaultConfiguration); + } +}