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


C# IDataProvider类代码示例

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


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

示例1: Load

        public async Task Load(string rootFolder)
        {
            var createTables = false;

            if (!_databaseFile.Exists)
            {
                SQLiteConnection.CreateFile(_databaseFile.FullName);
                createTables = true;
            }

            var dataProvider = new IDataProvider[] {Images, Artists, Albums, Tracks, Playlists};

            _connection = new SQLiteConnection($"Data Source={_databaseFile.FullName};Version=3;");
            await _connection.OpenAsync();

            if(createTables)
                foreach (var provider in dataProvider)
                    await provider.CreateTables(_connection);

            foreach (var data in dataProvider)
                await data.Load(_connection);
           
            var userDataFileInfo = new FileInfo(Path.Combine(rootFolder, UserDataFilename));

            if (userDataFileInfo.Exists)
                await UserData.LoadFromFile(userDataFileInfo.FullName);

            LoadSettings();
        }
开发者ID:caesay,项目名称:Hurricane,代码行数:29,代码来源:MusicDataManager.cs

示例2: RegisterDataProvider

        private void RegisterDataProvider(IDataProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            Type type = provider.GetType();
            List<MethodInfo> methods = type.GetMethods()
                                           .Where(IsEvaluator)
                                           .ToList();

            foreach (MethodInfo method in methods)
            {
                string key = GetArgumentName(method);
                Func<double> evaluator = CreateEvaluator(method, provider);

                if (_evaluators.ContainsKey(key))
                {
                    throw new InvalidOperationException(String.Format("Formula argument duplicate {0}", key));
                }

                _evaluators[key] = evaluator;
            }
        }
开发者ID:v-zubritsky,项目名称:MilitaryFaculty,代码行数:25,代码来源:ReportDataProvider.cs

示例3: Database

 public Database(IDataProvider provider, string connectionString)
 {
     Timeout = -1;
     Provider = provider;
     ConnectionString = connectionString;
     LogDatabaseProviderName(provider.ToString());
 }
开发者ID:philous,项目名称:sharpmigrations,代码行数:7,代码来源:Database.cs

示例4: HandlesDegenerateCaseWithMoreThanOneProviderButOneIsEmpty

        public void HandlesDegenerateCaseWithMoreThanOneProviderButOneIsEmpty()
        {
            DataBinding[][] bindingsPerProvider = new DataBinding[][] {
                new DataBinding[] { new DataBinding(0, null) },
                new DataBinding[] { new DataBinding(0, null) },
            };

            IDataProvider[] providers = new IDataProvider[] {
                Mocks.StrictMock<IDataProvider>(),
                Mocks.StrictMock<IDataProvider>()
            };

            IDataItem[][] itemsPerProvider = new IDataItem[][] {
                new IDataItem[] {
                    new ScalarDataItem<int>(1, null, true),
                    new ScalarDataItem<int>(2, null, false)
                },
                new IDataItem[0]
            };

            using (Mocks.Record())
            {
                SetupResult.For(providers[0].GetItems(bindingsPerProvider[0], true)).Return(itemsPerProvider[0]);
                SetupResult.For(providers[1].GetItems(bindingsPerProvider[1], true)).Return(itemsPerProvider[1]);
            }

            using (Mocks.Playback())
            {
                List<IList<IDataItem>> items = new List<IList<IDataItem>>(PairwiseJoinStrategy.Instance.Join(providers, bindingsPerProvider, true));
                Assert.Count(0, items);
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:32,代码来源:PairwiseJoinStrategyTest.cs

示例5: HandlesDegenerateCaseWithOneProvider

        public void HandlesDegenerateCaseWithOneProvider()
        {
            DataBinding[] bindings = new DataBinding[] {
                new DataBinding(0, null)
            };
            IDataProvider[] providers = new IDataProvider[] {
                Mocks.StrictMock<IDataProvider>()
            };

            using (Mocks.Record())
            {
                Expect.Call(providers[0].GetItems(bindings, true)).Return(new IDataItem[] {
                    new ScalarDataItem<int>(1, null, true),
                    new ScalarDataItem<int>(2, null, false),
                    new ScalarDataItem<int>(3, null, true)
                });
            }

            using (Mocks.Playback())
            {
                List<IDataItem> items = new List<IDataItem>(IntersectionMergeStrategy.Instance.Merge(providers, bindings, true));
                Assert.Count(3, items);

                Assert.AreEqual(1, items[0].GetValue(bindings[0]));
                Assert.IsTrue(items[0].IsDynamic);

                Assert.AreEqual(2, items[1].GetValue(bindings[0]));
                Assert.IsFalse(items[1].IsDynamic);

                Assert.AreEqual(3, items[2].GetValue(bindings[0]));
                Assert.IsTrue(items[2].IsDynamic);
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:33,代码来源:IntersectionMergeStrategyTest.cs

示例6: QueryConditional

 protected QueryConditional(Type[] dbtypes, Expression expr, IDataProvider dataProvider)
 {
     LoadObjects(dbtypes);
     DataProvider = dataProvider;
     string conditional = TranslateExtendtion.TranslateConditional(expr, DataProvider);
     this.strConditional = new StringBuilder(conditional);
 }
开发者ID:yaozd,项目名称:YOYOFx,代码行数:7,代码来源:QueryConditional.cs

示例7: SimpleRepositoryTests

        public SimpleRepositoryTests(IDataProvider provider)
        {
            _provider = provider;

            _repo = new SimpleRepository(_provider, SimpleRepositoryOptions.RunMigrations);
            try
            {
                var qry = new CodingHorror(_provider, "DROP TABLE Shwerkos").Execute();
            }
            catch { }

            try
            {
                new CodingHorror(_provider, "DROP TABLE DummyForDeletes").Execute();
            }
            catch { }

            try
            {
                new CodingHorror(_provider, "DROP TABLE Shwerko2s").Execute();
            }
            catch { }

            try
            {
                new CodingHorror(_provider, "DROP TABLE NonAutoIncrementingIdWithDefaultSettings").Execute();
            }
            catch { }
        }
开发者ID:andrecarlucci,项目名称:SubSonic-3.0,代码行数:29,代码来源:SimpleRepositoryTests.cs

示例8: Subscribe

 public void Subscribe(IDataProvider provider, InstrumentList instruments)
 {
     if (provider.Status != ProviderStatus.Connected)
     {
         provider.Connect();
     }
     InstrumentList instrumentList = new InstrumentList();
     for (int i = 0; i < instruments.Count; i++)
     {
         Instrument byIndex = instruments.GetByIndex(i);
         if (!this.subscriptions.ContainsKey((int)provider.Id))
         {
             this.subscriptions[(int)provider.Id] = new Dictionary<Instrument, int>();
         }
         if (!this.subscriptions[(int)provider.Id].ContainsKey(byIndex) || this.subscriptions[(int)provider.Id][byIndex] == 0)
         {
             this.subscriptions[(int)provider.Id][byIndex] = 0;
             instrumentList.Add(byIndex);
         }
         Dictionary<Instrument, int> dictionary;
         Instrument key;
         (dictionary = this.subscriptions[(int)provider.Id])[key = byIndex] = dictionary[key] + 1;
     }
     if (instrumentList.Count > 0)
     {
         provider.Subscribe(instrumentList);
     }
 }
开发者ID:ForTrade,项目名称:CSharp,代码行数:28,代码来源:SubscriptionManager.cs

示例9: CommandsTable

        public CommandsTable(IDataProvider provider)
            : base("Commands",provider)
        {
            ClassName = "Command";
                SchemaName = "";

                Columns.Add(new DatabaseColumn("CommandName", this)
                {
                    IsPrimaryKey = false,
                    DataType = DbType.AnsiString,
                    IsNullable = true,
                    AutoIncrement = false,
                    IsForeignKey = false,
                    MaxLength = 2147483647
                });

                Columns.Add(new DatabaseColumn("File", this)
                {
                    IsPrimaryKey = false,
                    DataType = DbType.AnsiString,
                    IsNullable = true,
                    AutoIncrement = false,
                    IsForeignKey = false,
                    MaxLength = 2147483647
                });
        }
开发者ID:rench,项目名称:PCRemote,代码行数:26,代码来源:Structs.cs

示例10: AddTaskViewModel

        public AddTaskViewModel(IDataProvider batchService, string jobId)
        {
            this.batchService = batchService;
            this.IsBusy = false;

            this.JobId = jobId;
        }
开发者ID:haricr,项目名称:azure-batch-samples,代码行数:7,代码来源:AddTaskViewModel.cs

示例11: Sample

 public Sample(string fileName, string fullPath, IDataProvider dataProvider)
 {
     _fileName = fileName;
     FullPath = fullPath;
     _dataProvider = dataProvider;
     dataProviderTypeId = dataProvider.TypeId;
 }
开发者ID:pol,项目名称:MassSpecStudio,代码行数:7,代码来源:Sample.cs

示例12: SimplestsTable

            public SimplestsTable(IDataProvider provider):base("Simplests",provider){
                ClassName = "Simplest";
                SchemaName = "dbo";
                

                Columns.Add(new DatabaseColumn("Id", this)
                {
	                IsPrimaryKey = true,
	                DataType = DbType.Int64,
	                IsNullable = false,
	                AutoIncrement = false,
	                IsForeignKey = false,
	                MaxLength = 0
                });

                Columns.Add(new DatabaseColumn("Value", this)
                {
	                IsPrimaryKey = false,
	                DataType = DbType.Int64,
	                IsNullable = false,
	                AutoIncrement = false,
	                IsForeignKey = false,
	                MaxLength = 0
                });
                    
                
                
            }
开发者ID:jogibear9988,项目名称:ormbattle,代码行数:28,代码来源:Structs.cs

示例13: AUSaleService

        public AUSaleService(
            IRepository<AULotRecord> lotRepo,
            IConsignorService consignorService,
            IAuthenticationService authenticationService,
            IRepository<AUConsignmentLotRecord> consignmentlotRepo,
            IRepository<AUCountryLotRecord> countrylotRepo,
            IRepository<AUStateProvinceLotRecord> stateprovincelotRepo,
            IRepository<AULotLotRecord> lotlotRepo,
            IRepository<AUSaleRecord> saleRepo,
            IProductService productService,
            IDataProvider dataProvider,
            IDbContext dbContext,
            ICategoryService categoryService

            )
        {
            this._lotRepo = lotRepo;
            this._consignorService = consignorService;
            this._authenticationService = authenticationService;
            this._consignmentlotRepo = consignmentlotRepo;
            this._countrylotRepo = countrylotRepo;
            this._stateprovincelotRepo = stateprovincelotRepo;
            this._lotlotRepo = lotlotRepo;
            this._saleRepo = saleRepo;
            this._productService = productService;
            this._dataProvider = dataProvider;
            this._dbContext = dbContext;
            this._categoryService = categoryService;
        }
开发者ID:HumanSystems,项目名称:nopcommerce-dev,代码行数:29,代码来源:AUSaleService.cs

示例14: ArticleStructs

        public ArticleStructs(IDataProvider provider)
            : base("Article",provider)
        {
            ClassName = "Article";
                SchemaName = "dbo";

                Columns.Add(new DatabaseColumn("Id", this)
                {
                    IsPrimaryKey = true,
                    DataType = DbType.Int64,
                    IsNullable = false,
                    AutoIncrement = true,
                    IsForeignKey = true,
                    MaxLength = 0,
                    PropertyName = "Id"
                });

                Columns.Add(new DatabaseColumn("ArticleName", this)
                {
                    IsPrimaryKey = false,
                    DataType = DbType.String,
                    IsNullable = false,
                    AutoIncrement = false,
                    IsForeignKey = false,
                    MaxLength = 255,
                    PropertyName = "ArticleName"
                });
        }
开发者ID:shjko,项目名称:SpeciesSolution,代码行数:28,代码来源:ArticleStructs.cs

示例15: Parser

 /// <summary>
 /// Creates a new Parser instance
 /// </summary>
 /// <param name="dataProvider">The provider of the screen data</param>
 public Parser(IDataProvider dataProvider, ILocatorFinder locatorFinder = null, INameFinder nameFinder = null, params ITool[] tools)
 {
     this.dataProvider = dataProvider;
     this.locatorFinder = locatorFinder;
     this.nameFinder = nameFinder;
     this.tools = tools;
 }
开发者ID:TA-Gen,项目名称:TA-Gen,代码行数:11,代码来源:Parser.cs


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