Exemplo n.º 1
0
        public WEBIMICDBEntities getWebIMICInfo()
        {
            string           providerName = "System.Data.SqlClient";
            ConnectionEntity objEntity    = getConnEntityWebIMICInfo();

            SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder();

            sqlBuilder.DataSource               = objEntity.serverName;
            sqlBuilder.InitialCatalog           = objEntity.databaseName;
            sqlBuilder.UserID                   = objEntity.userName;
            sqlBuilder.Password                 = objEntity.password;
            sqlBuilder.MultipleActiveResultSets = true;

            string providerString = sqlBuilder.ToString();

            EntityConnectionStringBuilder objEcsb = new EntityConnectionStringBuilder();

            objEcsb.Provider = providerName;
            objEcsb.ProviderConnectionString = providerString;
            //objEcsb.Metadata = @"res://*/eCenterTrainning.csdl|res://*/eCenterTrainningOffline.ssdl|res://*/eCenterTrainningOffline.msl";
            objEcsb.Metadata = @"res://*/WebIMICModel.csdl|res://*/WebIMICModel.ssdl|res://*/WebIMICModel.msl";
            EntityConnection objConnection = new EntityConnection(objEcsb.ToString());

            //TrainingCenterOfflineEntities objTraining = new TrainingCenterOfflineEntities(objConnection.ToString());
            WEBIMICDBEntities objTraining = new WEBIMICDBEntities(objEcsb.ToString());

            return(objTraining);
        }
Exemplo n.º 2
0
        public ConnectionEntity getConnEntityWebIMICInfo()
        {
            ConnectionEntity obj = new ConnectionEntity();

            obj.serverName   = DecryptInfo("" + ConfigurationManager.AppSettings["WebServer"]);
            obj.databaseName = DecryptInfo("" + ConfigurationManager.AppSettings["WebDatabase"]);
            obj.userName     = DecryptInfo("" + ConfigurationManager.AppSettings["WebUser"]);
            obj.password     = DecryptInfo("" + ConfigurationManager.AppSettings["WebPass"]);
            return(obj);
        }