Ejemplo n.º 1
0
        public MetaDataContext(DbConnection connection, string name)
        {
            StoreConnection     = connection;
            _ownStoreConnection = false;
            if (StoreConnection != null)
            {
                var workspace = new MetadataWorkspace(EntityDataContextMetadataLocator.GetPath(),
                                                      new[] { Assembly.GetExecutingAssembly() });

                Connection = new EntityConnection(workspace, StoreConnection);
            }
            else
            {
                Connection      = new EntityConnection("name=cissaEntities");
                StoreConnection = Connection.StoreConnection;
            }

            Name = name;
            Connection.Disposed += OnConnectionDisposed;
            Entities             = new cissaEntities(Connection)
            {
                CommandTimeout = 600
            };
            DbContext = new DbContext(Entities, true);
        }
Ejemplo n.º 2
0
        public MetaDataContext(string connectionString, string name)
        {
            StoreConnection           = new SqlConnection(connectionString);
            _ownStoreConnection       = true;
            StoreConnection.Disposed += OnStoreConnectionDisposed;
            Name = name;
            var workspace = new MetadataWorkspace(EntityDataContextMetadataLocator.GetPath(),
                                                  new[] { Assembly.GetExecutingAssembly() });

            Connection           = new EntityConnection(workspace, StoreConnection);
            Connection.Disposed += OnConnectionDisposed;
            Entities             = new cissaEntities(Connection)
            {
                CommandTimeout = 600
            };
            DbContext = new DbContext(Entities, true);
        }
Ejemplo n.º 3
0
        public DataContext(DbConnection connection, string name = "", DataContextType type = DataContextType.Meta | DataContextType.Document | DataContextType.Account)
        {
            if (connection != null)
            {
                var workspace = new MetadataWorkspace(EntityDataContextMetadataLocator.GetPath(),
                                                      new[] { Assembly.GetExecutingAssembly() });

                Connection = new EntityConnection(workspace, connection);
            }
            else
            {
                Connection = new EntityConnection("name=cissaEntities");
            }

            _ownConnection       = true;
            Name                 = String.IsNullOrEmpty(name) ? Connection.Database : name;
            DataType             = type;
            Connection.Disposed += OnConnectionDisposed;
            _entities            = new cissaEntities(Connection)
            {
                CommandTimeout = 600
            };
            DbContext = new DbContext(_entities, true);
        }