// 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;
        }
        /// <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;
        }
        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);
        }
        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;
        }
 [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();
 }
        [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();
        }
 /// <summary>
 /// Initializes a new instance of the System.Data.Linq.DataContext class by referencing a connection and a mapping source.
 /// </summary>
 /// <param name="connection">The connection used by the .NET Framework.</param>
 /// <param name="mapping">The System.Data.Linq.Mapping.MappingSource.</param>
 public ExtensionDataContext(IDbConnection connection, MappingSource mapping)
     : base(connection, mapping)
 {
 }
		public DataClasses1DataContext(System.Data.IDbConnection connection, MappingSource mappingSource) :
			base(connection, mappingSource)
		{
			OnCreated();
		}
 public linqChiTieuDanSuatDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 protected BaseDataContext(string fileOrServerOrConnection, MappingSource mapping)
     : base(GetContextConnectionString(fileOrServerOrConnection), mapping)
 {
 }
Beispiel #11
0
 public BookLibrary(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 public alisReporterContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 public DataContextBase(string connection, MappingSource mappingSource)
     : base(connection, mappingSource)
 {
     this.DataBasePath = FilePath(connection);
 }
Beispiel #14
0
 public DcGeneralDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
Beispiel #15
0
 public linqPhatHanhPayPostDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 public FamilyManagementDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
Beispiel #17
0
 public ScheduleDataDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 public PhantomReporterDBDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
Beispiel #19
0
 public ChatBotDataModelDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
Beispiel #20
0
 public AsyncRPGDataContext(string connection, MappingSource mappingSource)
     : base(connection, mappingSource)
 {
     this.OnCreated();
 }
 public Classwork___May_23DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
Beispiel #22
0
 public linqBuuTaGiuLaiDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 public DB(IDbConnection connection, MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     this.OnCreated();
 }
 public SQLRepositoryDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
Beispiel #25
0
		public AnnotationDataContext(System.Data.IDbConnection connection, MappingSource mappingSource) :
			base(connection, mappingSource)
		{
			OnCreated();
		}
 public SchedulingDataClassesDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
		public DataImageDataContext(IDbConnection connection, MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
Beispiel #28
0
 public BirdsDataClassDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 protected BaseDataContext(IDbConnection connection, MappingSource mapping)
     : base(connection, mapping)
 {
 }
Beispiel #30
0
		public DBSourceDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		public DataClasses1DataContext(string connection, MappingSource mappingSource) :
			base(connection, mappingSource)
		{
			OnCreated();
		}
 public CustomLibraryDataContext(string connectionString, MappingSource mappingSource)
     : base(connectionString, mappingSource)
 {
 }
Beispiel #33
0
 public MailSenderDBDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
		public DrivingSCool(string connection, MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			this.OnCreated();
		}
 /// <summary>
 /// Initializes a new instance of the System.Data.Linq.DataContext class by referencing a file source and a mapping source.
 /// </summary>
 /// <param name="fileOrServerOrConnection">
 /// This argument can be any one of the following: The name of a file where a SQL Server Express database resides.
 /// The name of a server where a database is present.
 /// In this case the provider uses the default database for a user.
 /// A complete connection string. LINQ to SQL just passes the string to the provider without modification.
 /// </param>
 /// <param name="mapping">The System.Data.Linq.Mapping.MappingSource.</param>
 public ExtensionDataContext(string fileOrServerOrConnection, MappingSource mapping)
     : base(fileOrServerOrConnection, mapping)
 {
 }
Beispiel #36
0
 public NorthwindDataContext( IDbConnection connection, MappingSource mappingSource )
     :
       base( connection, mappingSource )
 {
     OnCreated();
 }
 public CustomLibraryDataContext(MappingSource mappingSource)
     : base(connectionStringBuilder.ConnectionString, mappingSource)
 {
 }
Beispiel #38
0
 public JustBuyEntityDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }
 public CustomLibraryDataContext(IDbConnection connection, MappingSource mappingSource)
     : base(connection, mappingSource)
 {
 }
Beispiel #40
0
 static ContextFactory()
 {
     _tobserviceMappingSrc = CreateTOBMappingSource();
 }
		public PPDataContext(IDbConnection connection, MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			this.OnCreated();
		}
 public AttributedMetaModel(Type dataContextType, MappingSource mappingSource)
 {
     contextType = dataContextType;
     this.mappingSource = mappingSource;
     Load();
 }
Beispiel #43
0
 public Main(string connection, MappingSource mappingSource)
     : base(connection, mappingSource)
 {
     this.OnCreated();
 }
Beispiel #44
0
		public DocviewerDataContext(string connection, MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
 public TestDataContext(MappingSource mappingSource)
     : base(ConnectionString, mappingSource)
 {
     Log = Console.Out;
 }
Beispiel #46
0
		public AnnotationDataContext(string connection, MappingSource mappingSource) :
			base(connection, mappingSource)
		{
			OnCreated();
		}
 /// <summary>Creates a new DataContext with which to query and update data.</summary>
 /// <param name="connection">The connection string to use.</param>
 /// <param name="mappingSource">The mapping source to use.</param>
 public SampleDataContext(string connection, MappingSource mappingSource)
     : base(connection, mappingSource)
 {
     OnCreated();
 }
Beispiel #48
0
 public SuperligTakımDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
     base(connection, mappingSource)
 {
     OnCreated();
 }