本文整理汇总了C#中DbProviderManifest类的典型用法代码示例。如果您正苦于以下问题:C# DbProviderManifest类的具体用法?C# DbProviderManifest怎么用?C# DbProviderManifest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbProviderManifest类属于命名空间,在下文中一共展示了DbProviderManifest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
Check.NotNull(providerManifest, "providerManifest");
Check.NotNull(commandTree, "commandTree");
return CreateDbCommandDefinition(providerManifest, commandTree, new DbInterceptionContext());
}
开发者ID:hallco978,项目名称:entityframework,代码行数:7,代码来源:EntityProviderServices.cs
示例2: LegacyDbProviderManifestWrapperTests
static LegacyDbProviderManifestWrapperTests()
{
LegacyProviderManifest =
((Legacy.DbProviderServices)
((IServiceProvider)Legacy.DbProviderFactories.GetFactory("System.Data.SqlClient"))
.GetService(typeof(Legacy.DbProviderServices)))
.GetProviderManifest("2008");
ProviderManifestWrapper = new LegacyDbProviderManifestWrapper(LegacyProviderManifest);
const string emptyCsdl =
@"<Schema xmlns=""http://schemas.microsoft.com/ado/2009/11/edm"" Namespace=""dummy"" />";
using (var reader = XmlReader.Create(new StringReader(emptyCsdl)))
{
EdmPrimitiveTypes =
new EdmItemCollection(new[] { reader }).GetItems<PrimitiveType>().ToDictionary(t => t.Name, t => t);
}
using (var reader = XmlReader.Create(new StringReader(emptyCsdl)))
{
LegacyEdmPrimitiveTypes =
new LegacyMetadata.EdmItemCollection(new[] { reader })
.GetItems<LegacyMetadata.PrimitiveType>()
.ToDictionary(t => t.Name, t => t);
}
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:27,代码来源:LegacyDbProviderManifestWrapperTests.cs
示例3: CreateProviderManifest
/// <summary>
/// Creates the provider manifest wrapper.
/// </summary>
/// <param name="providerInvariantName">Provider invariant name.</param>
/// <param name="providerManifest">The provider manifest to be wrapped.</param>
/// <returns><see cref="DbProviderManifest"/> wrapper for given provider invariant name wrapping given provider manifest.</returns>
public virtual DbProviderManifest CreateProviderManifest(string providerInvariantName, DbProviderManifest providerManifest)
{
return new DbProviderManifestWrapper(
this.ProviderInvariantName,
providerInvariantName,
providerManifest);
}
开发者ID:CodingGorilla,项目名称:effort,代码行数:13,代码来源:DbProviderServicesBase.cs
示例4: CreateDbCommandDefinition
/// <summary>
/// Create a Command Definition object, given the connection and command tree
/// </summary>
/// <param name="connection"> connection to the underlying provider </param>
/// <param name="commandTree"> command tree for the statement </param>
/// <returns> an executable command definition object </returns>
/// <exception cref="ArgumentNullException">connection and commandTree arguments must not be null</exception>
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
Check.NotNull(providerManifest, "providerManifest");
Check.NotNull(commandTree, "commandTree");
var storeMetadata = (StoreItemCollection)commandTree.MetadataWorkspace.GetItemCollection(DataSpace.SSpace);
return CreateCommandDefinition(storeMetadata.StoreProviderFactory, commandTree);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:15,代码来源:EntityProviderServices.cs
示例5: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
return new CachingCommandDefinition(
_providerServices.CreateCommandDefinition(providerManifest, commandTree),
new CommandTreeFacts(commandTree),
_cacheTransactionHandler,
_cachingPolicy);
}
开发者ID:ahmelsayed,项目名称:efcache,代码行数:8,代码来源:CachingProviderServices.cs
示例6: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
Debug.Assert(providerManifest != null, "CreateCommandDefinition passed null provider manifest to CreateDbCommandDefinition?");
Debug.Assert(commandTree != null, "CreateCommandDefinition did not validate commandTree argument?");
var prototype = CreateCommand(providerManifest, commandTree);
var result = CreateCommandDefinition(prototype);
return result;
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:9,代码来源:SqlProviderServices.cs
示例7: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(
DbProviderManifest providerManifest, DbCommandTree commandTree)
{
if (commandTree == null)
throw new ArgumentNullException("commandTree");
SqlGenerator generator = null;
if (commandTree is DbQueryCommandTree)
generator = new SelectGenerator();
else if (commandTree is DbInsertCommandTree)
generator = new InsertGenerator();
else if (commandTree is DbUpdateCommandTree)
generator = new UpdateGenerator();
else if (commandTree is DbDeleteCommandTree)
generator = new DeleteGenerator();
else if (commandTree is DbFunctionCommandTree)
generator = new FunctionGenerator();
string sql = generator.GenerateSQL(commandTree);
EFMySqlCommand cmd = new EFMySqlCommand();
cmd.CommandText = sql;
if (generator is FunctionGenerator)
cmd.CommandType = (generator as FunctionGenerator).CommandType;
SetExpectedTypes(commandTree, cmd);
EdmFunction function = null;
if (commandTree is DbFunctionCommandTree)
function = (commandTree as DbFunctionCommandTree).EdmFunction;
// Now make sure we populate the command's parameters from the CQT's parameters:
foreach (KeyValuePair<string, TypeUsage> queryParameter in commandTree.Parameters)
{
DbParameter parameter = cmd.CreateParameter();
parameter.ParameterName = queryParameter.Key;
parameter.Direction = ParameterDirection.Input;
parameter.DbType = Metadata.GetDbType(queryParameter.Value);
FunctionParameter funcParam;
if (function != null &&
function.Parameters.TryGetValue(queryParameter.Key, false, out funcParam))
{
parameter.ParameterName = funcParam.Name;
parameter.Direction = Metadata.ModeToDirection(funcParam.Mode);
parameter.DbType = Metadata.GetDbType(funcParam.TypeUsage);
}
cmd.Parameters.Add(parameter);
}
// Now add parameters added as part of SQL gen
foreach (DbParameter p in generator.Parameters)
cmd.Parameters.Add(p);
return CreateCommandDefinition(cmd);
}
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:56,代码来源:ProviderServices.cs
示例8: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
var entityCommandDefinition = EntityCommandDefinition;
if (entityCommandDefinition == null)
{
entityCommandDefinition = new Mock<EntityCommandDefinition>(MockBehavior.Loose, null, null, null).Object;
}
return entityCommandDefinition;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:10,代码来源:FakeSqlProviderServices.cs
示例9: StoreItemCollection
// used by EntityStoreSchemaGenerator to start with an empty (primitive types only) StoreItemCollection and
// add types discovered from the database
internal StoreItemCollection(DbProviderFactory factory, DbProviderManifest manifest, string providerManifestToken)
: base(DataSpace.SSpace)
{
Debug.Assert(factory != null, "factory is null");
Debug.Assert(manifest != null, "manifest is null");
_providerFactory = factory;
_providerManifest = manifest;
_providerManifestToken = providerManifestToken;
_cachedCTypeFunction = new Memoizer<EdmFunction, EdmFunction>(ConvertFunctionSignatureToCType, null);
LoadProviderManifest(_providerManifest);
}
开发者ID:junxy,项目名称:entityframework,代码行数:14,代码来源:StoreItemCollection.cs
示例10: GetProviderInfo
public static DbProviderInfo GetProviderInfo(
this DbConnection connection, out DbProviderManifest providerManifest)
{
Contract.Requires(connection != null);
var providerServices = DbProviderServices.GetProviderServices(connection);
var providerManifestToken = providerServices.GetProviderManifestTokenChecked(connection);
var providerInfo = new DbProviderInfo(connection.GetProviderInvariantName(), providerManifestToken);
providerManifest = providerServices.GetProviderManifest(providerManifestToken);
return providerInfo;
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:13,代码来源:DbConnectionExtensions.cs
示例11: StoreItemCollection
// used by EntityStoreSchemaGenerator to start with an empty (primitive types only) StoreItemCollection and
// add types discovered from the database
internal StoreItemCollection(
DbProviderFactory factory, DbProviderManifest manifest, string providerInvariantName, string providerManifestToken)
: base(DataSpace.SSpace)
{
DebugCheck.NotNull(factory);
DebugCheck.NotNull(manifest);
_providerFactory = factory;
_providerManifest = manifest;
_providerInvariantName = providerInvariantName;
_providerManifestToken = providerManifestToken;
_cachedCTypeFunction = new Memoizer<EdmFunction, EdmFunction>(ConvertFunctionSignatureToCType, null);
LoadProviderManifest(_providerManifest);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:16,代码来源:StoreItemCollection.cs
示例12: GetProviderInfo
public static DbProviderInfo GetProviderInfo(
this DbConnection connection, out DbProviderManifest providerManifest)
{
DebugCheck.NotNull(connection);
var providerManifestToken = DbConfiguration
.GetService<IManifestTokenService>()
.GetProviderManifestToken(connection);
var providerInfo = new DbProviderInfo(connection.GetProviderInvariantName(), providerManifestToken);
providerManifest = DbProviderServices.GetProviderServices(connection).GetProviderManifest(providerManifestToken);
return providerInfo;
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:15,代码来源:DbConnectionExtensions.cs
示例13: CreateCommandDefinition
/// <summary>
/// Create a Command Definition object given a command tree.
/// </summary>
/// <param name="commandTree"> command tree for the statement </param>
/// <returns> an executable command definition object </returns>
/// <remarks>
/// This method simply delegates to the provider's implementation of CreateDbCommandDefinition.
/// </remarks>
public DbCommandDefinition CreateCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
Contract.Requires(providerManifest != null);
Contract.Requires(commandTree != null);
try
{
return CreateDbCommandDefinition(providerManifest, commandTree);
}
catch (ProviderIncompatibleException)
{
throw;
}
catch (Exception e)
{
if (e.IsCatchableExceptionType())
{
throw new ProviderIncompatibleException(Strings.ProviderDidNotCreateACommandDefinition, e);
}
throw;
}
}
开发者ID:junxy,项目名称:entityframework,代码行数:30,代码来源:DbProviderServices.cs
示例14: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
Debug.Assert(providerManifest != null, "providerManifest != null");
Debug.Assert(
providerManifest is LegacyDbProviderManifestWrapper, "providerManifest expected to be LegacyDbProviderManifestWrapper");
Debug.Assert(commandTree != null, "commandTree != null");
Debug.Assert(commandTree is DbQueryCommandTree, "Only query trees are supported");
Debug.Assert(commandTree.DataSpace == DataSpace.SSpace, "SSpace tree expected");
try
{
var legacyMetadata = commandTree.MetadataWorkspace.ToLegacyMetadataWorkspace();
var legacyQuery =
((DbQueryCommandTree)commandTree).Query.Accept(
new LegacyDbExpressionConverter(
(LegacyMetadata.StoreItemCollection)
legacyMetadata.GetItemCollection(LegacyMetadata.DataSpace.SSpace)));
var legacyCommandTree =
(LegacyCommandTrees.DbCommandTree)LegacyDbQueryCommandTreeCtor.Invoke(
new object[]
{
legacyMetadata,
LegacyMetadata.DataSpace.SSpace,
legacyQuery
});
return new LegacyDbCommandDefinitionWrapper(
_wrappedProviderServices.CreateCommandDefinition(
((LegacyDbProviderManifestWrapper)providerManifest).WrappedManifest,
legacyCommandTree));
}
catch (SystemData.ProviderIncompatibleException exception)
{
throw new ProviderIncompatibleException(exception.Message, exception.InnerException);
}
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:38,代码来源:LegacyDbProviderServicesWrapper.cs
示例15: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
return CreateCommandDefinition(CreateDbCommand(((NpgsqlProviderManifest)providerManifest).Version, commandTree));
}
开发者ID:neisbut,项目名称:npgsql,代码行数:4,代码来源:NpgsqlServices.cs
示例16: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
return new GlimpseDbCommandDefinition(InnerProviderServices.CreateCommandDefinition(commandTree));
}
开发者ID:Nangal,项目名称:Glimpse,代码行数:4,代码来源:GlimpseDbProviderServices.cs
示例17: CreateCommand
private DbCommand CreateCommand(DbProviderManifest manifest, DbCommandTree commandTree)
{
if (manifest == null)
throw new ArgumentNullException("manifest");
if (commandTree == null)
throw new ArgumentNullException("commandTree");
SQLiteCommand command = new SQLiteCommand();
try
{
List<DbParameter> parameters;
CommandType commandType;
command.CommandText = SqlGenerator.GenerateSql((SQLiteProviderManifest)manifest, commandTree, out parameters, out commandType);
command.CommandType = commandType;
// Get the function (if any) implemented by the command tree since this influences our interpretation of parameters
EdmFunction function = null;
if (commandTree is DbFunctionCommandTree)
{
function = ((DbFunctionCommandTree)commandTree).EdmFunction;
}
// Now make sure we populate the command's parameters from the CQT's parameters:
foreach (KeyValuePair<string, TypeUsage> queryParameter in commandTree.Parameters)
{
SQLiteParameter parameter;
// Use the corresponding function parameter TypeUsage where available (currently, the SSDL facets and
// type trump user-defined facets and type in the EntityCommand).
FunctionParameter functionParameter;
if (null != function && function.Parameters.TryGetValue(queryParameter.Key, false, out functionParameter))
{
parameter = CreateSqlParameter(functionParameter.Name, functionParameter.TypeUsage, functionParameter.Mode, DBNull.Value);
}
else
{
parameter = CreateSqlParameter(queryParameter.Key, queryParameter.Value, ParameterMode.In, DBNull.Value);
}
command.Parameters.Add(parameter);
}
// Now add parameters added as part of SQL gen (note: this feature is only safe for DML SQL gen which
// does not support user parameters, where there is no risk of name collision)
if (null != parameters && 0 < parameters.Count)
{
if (!(commandTree is DbInsertCommandTree) &&
!(commandTree is DbUpdateCommandTree) &&
!(commandTree is DbDeleteCommandTree))
{
throw new InvalidOperationException("SqlGenParametersNotPermitted");
}
foreach (DbParameter parameter in parameters)
{
command.Parameters.Add(parameter);
}
}
return command;
}
catch
{
command.Dispose();
throw;
}
}
开发者ID:jcwmoore,项目名称:athena,代码行数:69,代码来源:SQLiteProviderServices.cs
示例18: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
if (providerManifest == null)
throw new ArgumentNullException("providerManifest");
if (commandTree == null)
throw new ArgumentNullException("commandTree");
List<DbParameter> parameters;
CommandType commandType;
string commandText = SqlGenerator.GenerateSql(commandTree, out parameters, out commandType);
DbCommand command = null;
if (commandType == NuoDbMultipleCommands.MultipleTexts)
command = new NuoDbMultipleCommands(PrepareTypeCoercions(commandTree));
else
command = new NuoDbCommand(PrepareTypeCoercions(commandTree));
command.CommandText = commandText;
command.CommandType = commandType;
// Get the function (if any) implemented by the command tree since this influences our interpretation of parameters
EdmFunction function = null;
if (commandTree is DbFunctionCommandTree)
{
function = ((DbFunctionCommandTree)commandTree).EdmFunction;
}
foreach (KeyValuePair<string, TypeUsage> queryParameter in commandTree.Parameters)
{
NuoDbParameter parameter;
// Use the corresponding function parameter TypeUsage where available (currently, the SSDL facets and
// type trump user-defined facets and type in the EntityCommand).
FunctionParameter functionParameter;
if (null != function && function.Parameters.TryGetValue(queryParameter.Key, false, out functionParameter))
{
parameter = CreateSqlParameter(functionParameter.Name, functionParameter.TypeUsage, functionParameter.Mode, DBNull.Value);
}
else
{
parameter = CreateSqlParameter(queryParameter.Key, queryParameter.Value, ParameterMode.In, DBNull.Value);
}
command.Parameters.Add(parameter);
}
// Now add parameters added as part of SQL gen (note: this feature is only safe for DML SQL gen which
// does not support user parameters, where there is no risk of name collision)
if (null != parameters && 0 < parameters.Count)
{
if (!(commandTree is DbInsertCommandTree) &&
!(commandTree is DbUpdateCommandTree) &&
!(commandTree is DbDeleteCommandTree))
{
throw new InvalidOperationException("SqlGenParametersNotPermitted");
}
foreach (DbParameter parameter in parameters)
{
command.Parameters.Add(parameter);
}
}
return CreateCommandDefinition(command);
}
开发者ID:helluvamatt,项目名称:nuodb-dotnet,代码行数:64,代码来源:NuoDbProviderServices.cs
示例19: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
{
return CreateCommandDefinition(CreateDbCommand(commandTree));
}
开发者ID:NoeGarcia,项目名称:Npgsql,代码行数:4,代码来源:NpgsqlServices.cs
示例20: CreateDbCommandDefinition
protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest manifest, DbCommandTree commandTree)
{
DbCommand prototype = CreateCommand(manifest, commandTree);
DbCommandDefinition result = this.CreateCommandDefinition(prototype);
return result;
}
开发者ID:jcwmoore,项目名称:athena,代码行数:6,代码来源:SQLiteProviderServices.cs
注:本文中的DbProviderManifest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论