本文整理汇总了C#中System.Data.Common.DbProviderFactory.GetProviderInvariantName方法的典型用法代码示例。如果您正苦于以下问题:C# DbProviderFactory.GetProviderInvariantName方法的具体用法?C# DbProviderFactory.GetProviderInvariantName怎么用?C# DbProviderFactory.GetProviderInvariantName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Common.DbProviderFactory
的用法示例。
在下文中一共展示了DbProviderFactory.GetProviderInvariantName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EntityCommandDefinition
internal EntityCommandDefinition(
DbProviderFactory storeProviderFactory,
DbCommandTree commandTree,
DbInterceptionContext interceptionContext,
IDbDependencyResolver resolver = null,
BridgeDataReaderFactory bridgeDataReaderFactory = null,
ColumnMapFactory columnMapFactory = null)
{
DebugCheck.NotNull(storeProviderFactory);
DebugCheck.NotNull(commandTree);
DebugCheck.NotNull(interceptionContext);
_bridgeDataReaderFactory = bridgeDataReaderFactory ?? new BridgeDataReaderFactory();
_columnMapFactory = columnMapFactory ?? new ColumnMapFactory();
_storeProviderServices =
(resolver != null
? resolver.GetService<DbProviderServices>(storeProviderFactory.GetProviderInvariantName())
: null) ??
storeProviderFactory.GetProviderServices();
try
{
if (DbCommandTreeKind.Query
== commandTree.CommandTreeKind)
{
// Next compile the plan for the command tree
var mappedCommandList = new List<ProviderCommandInfo>();
ColumnMap columnMap;
int columnCount;
PlanCompiler.Compile(commandTree, out mappedCommandList, out columnMap, out columnCount, out _entitySets);
_columnMapGenerators = new IColumnMapGenerator[] { new ConstantColumnMapGenerator(columnMap, columnCount) };
// Note: we presume that the first item in the ProviderCommandInfo is the root node;
Debug.Assert(mappedCommandList.Count > 0, "empty providerCommandInfo collection and no exception?");
// this shouldn't ever happen.
// Then, generate the store commands from the resulting command tree(s)
_mappedCommandDefinitions = new List<DbCommandDefinition>(mappedCommandList.Count);
foreach (var providerCommandInfo in mappedCommandList)
{
var providerCommandDefinition = _storeProviderServices.CreateCommandDefinition(
providerCommandInfo.CommandTree, interceptionContext);
if (null == providerCommandDefinition)
{
throw new ProviderIncompatibleException(Strings.ProviderReturnedNullForCreateCommandDefinition);
}
_mappedCommandDefinitions.Add(providerCommandDefinition);
}
}
else
{
Debug.Assert(
DbCommandTreeKind.Function == commandTree.CommandTreeKind, "only query and function command trees are supported");
var entityCommandTree = (DbFunctionCommandTree)commandTree;
// Retrieve mapping and metadata information for the function import.
var mapping = GetTargetFunctionMapping(entityCommandTree);
IList<FunctionParameter> returnParameters = entityCommandTree.EdmFunction.ReturnParameters;
var resultSetCount = returnParameters.Count > 1 ? returnParameters.Count : 1;
_columnMapGenerators = new IColumnMapGenerator[resultSetCount];
var storeResultType = DetermineStoreResultType(mapping, 0, out _columnMapGenerators[0]);
for (var i = 1; i < resultSetCount; i++)
{
DetermineStoreResultType(mapping, i, out _columnMapGenerators[i]);
}
// Copy over parameters (this happens through a more indirect route in the plan compiler, but
// it happens nonetheless)
var providerParameters = new List<KeyValuePair<string, TypeUsage>>();
foreach (var parameter in entityCommandTree.Parameters)
{
providerParameters.Add(parameter);
}
// Construct store command tree usage.
var providerCommandTree = new DbFunctionCommandTree(
entityCommandTree.MetadataWorkspace, DataSpace.SSpace,
mapping.TargetFunction, storeResultType, providerParameters);
var storeCommandDefinition = _storeProviderServices.CreateCommandDefinition(providerCommandTree);
_mappedCommandDefinitions = new List<DbCommandDefinition>(1)
{
storeCommandDefinition
};
var firstResultEntitySet = mapping.FunctionImport.EntitySets.FirstOrDefault();
if (firstResultEntitySet != null)
{
_entitySets = new Set<EntitySet>();
_entitySets.Add(mapping.FunctionImport.EntitySets.FirstOrDefault());
_entitySets.MakeReadOnly();
}
}
// Finally, build a list of the parameters that the resulting command should have;
var parameterList = new List<EntityParameter>();
//.........这里部分代码省略.........