0
|
1 using System;
|
|
2
|
|
3 namespace BLToolkit.Data.Linq
|
|
4 {
|
|
5 using Data.Sql.SqlProvider;
|
|
6 using DataProvider;
|
|
7 using Mapping;
|
|
8
|
|
9 class DefaultDataContextInfo : IDataContextInfo
|
|
10 {
|
|
11 private IDataContext _dataContext;
|
|
12 public IDataContext DataContext { get { return _dataContext ?? (_dataContext = new DbManager()); } }
|
|
13
|
|
14 public MappingSchema MappingSchema { get { return Map.DefaultSchema; } }
|
|
15 public bool DisposeContext { get { return true; } }
|
|
16 public string ContextID { get { return _dataProvider.Name; } }
|
|
17
|
|
18 public ISqlProvider CreateSqlProvider()
|
|
19 {
|
|
20 return _dataProvider.CreateSqlProvider();
|
|
21 }
|
|
22
|
|
23 public IDataContextInfo Clone(bool forNestedQuery)
|
|
24 {
|
|
25 return new DataContextInfo(DataContext.Clone(forNestedQuery));
|
|
26 }
|
|
27
|
|
28 static readonly DataProviderBase _dataProvider = DbManager.GetDataProvider(DbManager.DefaultConfiguration);
|
|
29 }
|
|
30 }
|