本文整理汇总了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();
}
示例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;
}
}
示例3: Database
public Database(IDataProvider provider, string connectionString)
{
Timeout = -1;
Provider = provider;
ConnectionString = connectionString;
LogDatabaseProviderName(provider.ToString());
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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 { }
}
示例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);
}
}
示例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
});
}
示例10: AddTaskViewModel
public AddTaskViewModel(IDataProvider batchService, string jobId)
{
this.batchService = batchService;
this.IsBusy = false;
this.JobId = jobId;
}
示例11: Sample
public Sample(string fileName, string fullPath, IDataProvider dataProvider)
{
_fileName = fileName;
FullPath = fullPath;
_dataProvider = dataProvider;
dataProviderTypeId = dataProvider.TypeId;
}
示例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
});
}
示例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;
}
示例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"
});
}
示例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;
}