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);
        }
        //public TrainingCenterEntities getTrainingCenter()
        //{
        //    Common objCommon = new Common();
        //    TrainingCenterEntities objTraining = objCommon.getTrainingCenterInfo();
        //    return objTraining;
        //}

        public WEBIMICDBEntities getWebImic()
        {
            Common            objCommon   = new Common();
            WEBIMICDBEntities objTraining = objCommon.getWebIMICInfo();

            return(objTraining);
        }