comparison Source/Data/Linq/DataContextInfo.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2
3 namespace BLToolkit.Data.Linq
4 {
5 using Data.Sql.SqlProvider;
6 using Mapping;
7
8 public class DataContextInfo : IDataContextInfo
9 {
10 public DataContextInfo(IDataContext dataContext)
11 {
12 DataContext = dataContext;
13 DisposeContext = false;
14 }
15
16 public DataContextInfo(IDataContext dataContext, bool disposeContext)
17 {
18 DataContext = dataContext;
19 DisposeContext = disposeContext;
20 }
21
22 public IDataContext DataContext { get; private set; }
23 public bool DisposeContext { get; private set; }
24 public string ContextID { get { return DataContext.ContextID; } }
25 public MappingSchema MappingSchema { get { return DataContext.MappingSchema; } }
26
27 public ISqlProvider CreateSqlProvider()
28 {
29 return DataContext.CreateSqlProvider();
30 }
31
32 public IDataContextInfo Clone(bool forNestedQuery)
33 {
34 return new DataContextInfo(DataContext.Clone(forNestedQuery));
35 }
36
37 public static IDataContextInfo Create(IDataContext dataContext)
38 {
39 #if SILVERLIGHT
40 if (dataContext == null) throw new ArgumentNullException("dataContext");
41 return new DataContextInfo(dataContext);
42 #else
43 return dataContext == null ? (IDataContextInfo)new DefaultDataContextInfo() : new DataContextInfo(dataContext);
44 #endif
45 }
46 }
47 }