本文整理汇总了C#中System.Data.Linq.Mapping.MappingSource类的典型用法代码示例。如果您正苦于以下问题:C# MappingSource类的具体用法?C# MappingSource怎么用?C# MappingSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MappingSource类属于System.Data.Linq.Mapping命名空间,在下文中一共展示了MappingSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataContextFactory
// static initialization of connectionstring and mappingSource.
// This significantly increases performance, primarily due to mappingSource cache.
static DataContextFactory()
{
connectionString = ConfigurationManager.ConnectionStrings["Action"].ConnectionString;
var context = new ActionDataContext(connectionString);
mappingSource = context.Mapping.MappingSource;
}
示例2: DataContextFactory
/// <summary>
/// Static constructor.
/// </summary>
/// <remarks>
/// Static initialization of connectionstring and mappingSource.
/// This significantly increases performance, primarily due to mappingSource cache.
/// </remarks>
static DataContextFactory()
{
string connectionStringName = ConfigurationManager.AppSettings.Get("ConnectionStringName");
_connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
DataContext context = new ActionDataContext(_connectionString);
_mappingSource = context.Mapping.MappingSource;
}
示例3: ExtensibleDataContext
public ExtensibleDataContext(object connection, MappingSource mapping)
: base("", mapping)
{
FieldInfo providerField = typeof(System.Data.Linq.DataContext).GetField("provider", BindingFlags.Instance | BindingFlags.NonPublic);
object proxy = new ProviderProxy(this).GetTransparentProxy();
providerField.SetValue(this, proxy);
this.Initialize(connection);
}
示例4: AttributedMetaModel
internal AttributedMetaModel(MappingSource mappingSource, Type contextType) {
this.mappingSource = mappingSource;
this.contextType = contextType;
this.metaTypes = new Dictionary<Type, MetaType>();
this.metaTables = new Dictionary<Type, MetaTable>();
this.metaFunctions = new Dictionary<MetaPosition, MetaFunction>();
// Provider type
ProviderAttribute[] attrs = (ProviderAttribute[])this.contextType.GetCustomAttributes(typeof(ProviderAttribute), true);
if (attrs != null && attrs.Length == 1) { // Provider attribute is !AllowMultiple
this.providerType = attrs[0].Type;
} else {
this.providerType = typeof(SqlProvider);
}
// Database name
DatabaseAttribute[] das = (DatabaseAttribute[])this.contextType.GetCustomAttributes(typeof(DatabaseAttribute), false);
this.dbName = (das != null && das.Length > 0) ? das[0].Name : this.contextType.Name;
}
示例5: MappedMetaModel
[ResourceConsumption(ResourceScope.Assembly | ResourceScope.Machine)] // FindType method call.
internal MappedMetaModel(MappingSource mappingSource, Type contextType, DatabaseMapping mapping) {
this.mappingSource = mappingSource;
this.contextType = contextType;
this.mapping = mapping;
this.modules = new HashSet<Module>();
this.modules.Add(this.contextType.Module);
this.metaTypes = new Dictionary<Type, MetaType>();
this.metaTables = new Dictionary<Type, MetaTable>();
this.types = new Dictionary<string, Type>();
// Provider type
if (this.providerType == null && !String.IsNullOrEmpty(this.mapping.Provider)) {
this.providerType = this.FindType(this.mapping.Provider, typeof(SqlProvider).Namespace);
if (this.providerType == null) {
throw Error.ProviderTypeNotFound(this.mapping.Provider);
}
}
else if (this.providerType == null) {
this.providerType = typeof(SqlProvider);
}
this.Init();
}
示例6: MappedMetaModel
[ResourceConsumption(ResourceScope.Assembly | ResourceScope.Machine)] // FindType method call.
internal MappedMetaModel(MappingSource mappingSource, Type contextType, DatabaseMapping mapping) {
this.mappingSource = mappingSource;
this.contextType = contextType;
this.mapping = mapping;
this.modules = new HashSet<Module>();
this.modules.Add(this.contextType.Module);
this.metaTypes = new Dictionary<Type, MetaType>();
this.metaTables = new Dictionary<Type, MetaTable>();
this.types = new Dictionary<string, Type>();
#warning [FB] REFACTOR SQL Server specific. Requires change to have its provider type injected instead of it tries to discover it on its own using sql server's specific namespace.
// Provider type
if (this.providerType == null && !String.IsNullOrEmpty(this.mapping.Provider)) {
this.providerType = this.FindType(this.mapping.Provider, typeof(System.Data.Linq.DbEngines.SqlServer.SqlProvider).Namespace);
if (this.providerType == null) {
throw Error.ProviderTypeNotFound(this.mapping.Provider);
}
}
else if (this.providerType == null) {
this.providerType = typeof(System.Data.Linq.DbEngines.SqlServer.SqlProvider);
}
this.Init();
}
示例7: CustomLibraryDataContext
public CustomLibraryDataContext(IDbConnection connection, MappingSource mappingSource)
: base(connection, mappingSource)
{
}
开发者ID:WilliamRobertMontgomery,项目名称:asp-dot-net-training-project,代码行数:4,代码来源:CustomLibraryDataContext.cs
示例8: DB
public DB(IDbConnection connection, MappingSource mappingSource) :
base(connection, mappingSource)
{
this.OnCreated();
}
示例9: AnnotationDataContext
public AnnotationDataContext(System.Data.IDbConnection connection, MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
示例10: NorthwindDataContext
public NorthwindDataContext( IDbConnection connection, MappingSource mappingSource )
:
base( connection, mappingSource )
{
OnCreated();
}
示例11: DataContextBase
public DataContextBase(string connection, MappingSource mappingSource)
: base(connection, mappingSource)
{
this.DataBasePath = FilePath(connection);
}
示例12: DataClasses1DataContext
public DataClasses1DataContext(string connection, MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
示例13: BaseDataContext
protected BaseDataContext(IDbConnection connection, MappingSource mapping)
: base(connection, mapping)
{
}
示例14: AttributedMetaModel
public AttributedMetaModel(Type dataContextType, MappingSource mappingSource)
{
contextType = dataContextType;
this.mappingSource = mappingSource;
Load();
}
示例15: DataImageDataContext
public DataImageDataContext(IDbConnection connection, MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}