当前位置: 首页>>代码示例>>C#>>正文


C# DataProvider类代码示例

本文整理汇总了C#中DataProvider的典型用法代码示例。如果您正苦于以下问题:C# DataProvider类的具体用法?C# DataProvider怎么用?C# DataProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataProvider类属于命名空间,在下文中一共展示了DataProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Difference

        public static string Difference(DataProvider from, DataProvider to, string dbNameFrom, string dbNameTo)
        {
            DatabaseName dname1 = new DatabaseName(from, dbNameFrom);
            DatabaseName dname2 = new DatabaseName(to, dbNameTo);

            string[] names = MetaDatabase.GetTableNames(dname1);

            StringBuilder builder = new StringBuilder();
            foreach (string tableName in names)
            {
                TableName tname1 = new TableName(dname1, tableName);
                TableName tname2 = new TableName(dname2, tableName);

                string[] primaryKeys = InformationSchema.PrimaryKeySchema(tname1).ToArray<string>(0);
                if (primaryKeys.Length == 0)
                    continue;

                if (MetaDatabase.TableExists(tname2))
                {
                    builder.Append(TableCompare.Difference(tname1, tname2, tableName, primaryKeys));
                }
                else
                {
                    builder.Append(TableCompare.Rows(tableName, from));
                }

                builder.AppendLine();
            }

            return builder.ToString();
        }
开发者ID:fjiang2,项目名称:sqlcon,代码行数:31,代码来源:DatabaseCompare.cs

示例2: MatchReferencePredicate

 public MatchReferencePredicate(DataProvider provider, Type entityType, string propertyName, Type referencedEntityType, Guid referencedEntityID, string mirrorPropertyName)
 {
     ReferencedEntityID = referencedEntityID;
     PropertyName = propertyName;
     ReferencedEntityType = referencedEntityType;
     MirrorPropertyName = mirrorPropertyName;
 }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:7,代码来源:MatchReferencePredicate.cs

示例3: CreateConnectionStringBuilder

        public static DbConnectionStringBuilder CreateConnectionStringBuilder(DataProvider dataProvider)
        {
            DbConnectionStringBuilder dbConnectionStringBuilder;

            switch (dataProvider)
            {
                case DataProvider.Odbc:
                    dbConnectionStringBuilder = new OdbcConnectionStringBuilder();
                    break;

                case DataProvider.OleDB:
                    dbConnectionStringBuilder = new OleDbConnectionStringBuilder();
                    break;

                case DataProvider.SqlServer:
                    dbConnectionStringBuilder = new SqlConnectionStringBuilder();
                    break;

                default:
                    dbConnectionStringBuilder = null;
                    break;
            }

            return dbConnectionStringBuilder;
        }
开发者ID:rfagioli,项目名称:OSWebProject,代码行数:25,代码来源:DataAccessBuilder.cs

示例4: CreateConnection

        public static DbConnection CreateConnection(DataProvider dataProvider)
        {
            DbConnection dbConnection;

            switch (dataProvider)
            {
                case DataProvider.Odbc:
                    dbConnection = new OdbcConnection();
                    break;

                case DataProvider.OleDB:
                    dbConnection = new OleDbConnection();
                    break;

                case DataProvider.SqlServer:
                    dbConnection = new SqlConnection();
                    break;

                default:
                    dbConnection = null;
                    break;
            }

            return dbConnection;
        }
开发者ID:rfagioli,项目名称:OSWebProject,代码行数:25,代码来源:DataAccessBuilder.cs

示例5: MyConnectionSql

        public MyConnectionSql(DataProvider dataProvider)
            : base(dataProvider)
        {
            SqlConnection conn = new SqlConnection(@"server = .\sqlexpress; integrated security = true;");

            try
            {
                // Abrir la conexión
                conn.Open();

                // Detalles de la conexión
                this.DetallesConexion(conn);

            }
            catch (SqlException ex)
            {
                // Desplegar la excepción e el error
                Console.WriteLine("Error: " + ex.Message + ex.StackTrace);
            }
            finally
            {
                // Cerrar la conexión
                conn.Close();
                Console.WriteLine("Conexión cerrada.");
            }
        }
开发者ID:POO-III-2015,项目名称:FabricaConexiones,代码行数:26,代码来源:MyConnectionSql.cs

示例6: MyConnectionOdbc

        public MyConnectionOdbc(DataProvider dataProvider)
            : base(dataProvider)
        {
            // Crear conexión
            OdbcConnection conn = new OdbcConnection(@"provider = sqlodbc;
                data source = .\sqlexpress; trusted connection = yes;");

            try
            {
                // Abrir conexión
                conn.Open();
                Console.WriteLine("Conexión establecida.");

                // Detalles de la conexión
                this.DetallesConexion(conn);
            }
            catch (OdbcException ex)
            {
                // Desplegar excepción o error
                Console.WriteLine("Error: " + ex.Message + ex.StackTrace);
            }
            finally
            {
                //Cerrar la conexión
                conn.Close();
            }
        }
开发者ID:POO-III-2015,项目名称:FabricaConexiones,代码行数:27,代码来源:MyConnectionOdbc.cs

示例7: MyConnectionOleDb

        public MyConnectionOleDb(DataProvider dataProvider)
            : base(dataProvider)
        {
            // Crear conexión
            OleDbConnection conn = new OleDbConnection(@"provider = sqloledb;
                data source = .\sqlexpress; integrated security = sspi;");

            try
            {
                // Abrir conexión
                conn.Open();
                Console.WriteLine("Conexión establecida.");

                // Detalles de la conexión
                this.DetallesConexion(conn);
            }
            catch (OleDbException ex)
            {
                // Desplegar excepción o error
                Console.WriteLine("Error: " + ex.Message + ex.StackTrace);
            }
            finally
            {
                //Cerrar la conexión
                conn.Close();
            }
        }
开发者ID:POO-III-2015,项目名称:FabricaConexiones,代码行数:27,代码来源:MyConnectionOleDb.cs

示例8: textBox1_TextChanged

 private void textBox1_TextChanged(object sender, System.EventArgs e)
 {
     using (var dataProvider = new DataProvider())
     {
        
     }
 }
开发者ID:pedropozzer,项目名称:PostgresWithEntity,代码行数:7,代码来源:FormCliente.cs

示例9: OnActionExecuting

        // Called before the action in the inherited controller is executed, allowing certain members to be set
        protected override void OnActionExecuting(ActionExecutingContext ctx)
        {
            base.OnActionExecuting(ctx);

            this.db = HengeApplication.DataProvider;
            this.globals = HengeApplication.Globals;

            // If the user has logged in then add their name to the view data
            if (this.User.Identity.IsAuthenticated)
            {
                this.user					= this.db.Get<User>(x => x.Name == this.User.Identity.Name);
                this.avatar					= Session["Avatar"] as Avatar;
                if(this.avatar != null && this.avatar.User != this.user) {
                    this.avatar = null;
                }
                this.cache					= Session["Cache"] as Cache;

                this.ViewData["User"] 		= this.User.Identity.Name;
                this.ViewData["Character"]	= (this.avatar != null) ? string.Format("{0} of {1}", this.avatar.Name, this.user.Clan) : null;
            }
            else
            {
                this.user 	= null;
                this.avatar	= null;
            }
        }
开发者ID:justen,项目名称:henge,代码行数:27,代码来源:MasterController.cs

示例10: AddRecord

		private void AddRecord(DataProvider dataProvider, EmployeeZonesDataSet ds, RubezhDAL.DataClasses.PassJournal record, EmployeeZonesReportFilter filter, bool isEnter, Dictionary<Guid, string> zoneMap)
		{
			if (record.EmployeeUID == null)
				return;
			var dataRow = ds.Data.NewDataRow();
			var employee = dataProvider.GetEmployee(record.EmployeeUID.Value);
			dataRow.Employee = employee.Name;
			dataRow.Orgnisation = employee.Organisation;
			dataRow.Department = employee.Department;
			dataRow.Position = employee.Position;
			dataRow.Zone = zoneMap.ContainsKey(record.ZoneUID) ? zoneMap[record.ZoneUID] : null;
			dataRow.EnterDateTime = record.EnterTime;
			if (record.ExitTime.HasValue)
			{
				dataRow.ExitDateTime = record.ExitTime.Value;
				dataRow.Period = dataRow.ExitDateTime - dataRow.EnterDateTime;
			}
			else
			{
				dataRow.ExitDateTime = filter.ReportDateTime;
				dataRow.Period = filter.ReportDateTime - dataRow.EnterDateTime;
			}

			if (!filter.IsEmployee)
			{
				var escortUID = employee.Item.EscortUID;
				if (escortUID.HasValue)
				{
					var escort = dataProvider.GetEmployee(escortUID.Value);
					dataRow.Escort = escort.Name;
				}
			}
			ds.Data.Rows.Add(dataRow);
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:34,代码来源:EmployeeZonesReport.cs

示例11: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            dataProvider = new DataProvider(XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("Lines.xml")), XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("Stations.xml")), XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("StationLines.xml")));

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            spinnerLine = FindViewById<Spinner>(Resource.Id.spinnerLine);
            spinnerStationFrom = FindViewById<Spinner>(Resource.Id.spinnerStationFrom);
            spinnerStationTo = FindViewById<Spinner>(Resource.Id.spinnerStationTo);

            Button buttonSwap = FindViewById<Button>(Resource.Id.buttonSwap);
            buttonSwap.Click += new EventHandler(swapDirection);

            Button buttonSave = FindViewById<Button>(Resource.Id.buttonSave);
            buttonSave.Click += new EventHandler(SaveSettings);

            Button buttonSearch = FindViewById<Button>(Resource.Id.buttonSearch);
            buttonSearch.Click += new EventHandler(lookup);

            SetUpLine();
            SetUpStationFrom();
            SetUpStationTo();
        }
开发者ID:MWGNZ,项目名称:Wellington-Trains,代码行数:26,代码来源:MainActivity.cs

示例12: GetTransaction

        public static IDbTransaction GetTransaction(DataProvider providerType, IDbConnection connection)
        {
            IDbConnection iDbConnection = null;
            IDbTransaction iDbTransaction = null;

            try
            {
                iDbConnection = connection;

                if (iDbConnection != null)
                {
                    if (iDbConnection.State != ConnectionState.Open)
                        iDbConnection.Open();

                    iDbTransaction = iDbConnection.BeginTransaction();
                }
            }

            catch (Exception ex)
            {
                iDbConnection = null;
                iDbTransaction = null;

                throw ex;
            }

            return iDbTransaction;
        }
开发者ID:sam9araujo,项目名称:ASP.NET,代码行数:28,代码来源:DBManagerFactory.cs

示例13: CreateCommand

        public static DbCommand CreateCommand(DataProvider dataProvider)
        {
            DbCommand dbCommand;

            switch (dataProvider)
            {
                case DataProvider.Odbc:
                    dbCommand = new OdbcCommand();
                    break;

                case DataProvider.OleDB:
                    dbCommand = new OleDbCommand();
                    break;

                case DataProvider.SqlServer:
                    dbCommand = new SqlCommand();
                    break;

                default:
                    dbCommand = null;
                    break;
            }

            return dbCommand;
        }
开发者ID:rfagioli,项目名称:OSWebProject,代码行数:25,代码来源:DataAccessBuilder.cs

示例14: CreateId

 /// <summary>
 /// Tạo id - khóa chính
 /// </summary>
 /// <param name="strFormat">Chuỗi định dạng</param>
 /// <param name="pTable">Bảng muốn tạo khóa chính</param>
 /// <returns>Khóa chính</returns>
 public string CreateId(string strFormat, string pTable)
 {
     string id;
     DataProvider dp = new DataProvider();
     DataTable dt = new DataTable();
     dt = GetAll(pTable);
     int rowCount = dt.Rows.Count + 1;
     string row;
     if (rowCount < 10)
     {
         row = "000" + rowCount.ToString();
     }
     else if (rowCount >= 10 && rowCount < 100)
     {
         row = "00" + rowCount.ToString();
     }
     else if (rowCount >= 100 && rowCount < 1000)
     {
         row = "0" + rowCount.ToString();
     }
     else
         row = rowCount.ToString();
     id = strFormat.ToString() + row.ToString();
     return id;
 }
开发者ID:ViniciusConsultor,项目名称:tqk-quanlykho,代码行数:31,代码来源:CFunction.cs

示例15: GetPosition

		private static IEnumerable<OrganisationBaseObjectInfo<Position>> GetPosition(DataProvider dataProvider, PositionsReportFilter filter)
		{
			var organisationUID = Guid.Empty;
			var organisations = dataProvider.Organisations.Where(org => filter.User == null || filter.User.IsAdm || org.Value.Item.UserUIDs.Any(y => y == filter.User.UID));
			if (filter.Organisations.IsEmpty())
			{
				if (filter.IsDefault)
					organisationUID = organisations.FirstOrDefault().Key;
			}
			else
			{
				organisationUID = organisations.FirstOrDefault(org => org.Key == filter.Organisations.FirstOrDefault()).Key;
			}

			IEnumerable<OrganisationBaseObjectInfo<Position>> positions = null;
			if (organisationUID != Guid.Empty)
			{
				positions = dataProvider.Positions.Values.Where(item => item.OrganisationUID == organisationUID);

				if (!filter.UseArchive)
					positions = positions.Where(item => !item.IsDeleted);
				if (!filter.Positions.IsEmpty())
					positions = positions.Where(item => filter.Positions.Contains(item.UID));
			}
			return positions != null ? positions : new List<OrganisationBaseObjectInfo<Position>>();
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:26,代码来源:PositionsReport.cs


注:本文中的DataProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。