本文整理汇总了C#中System.Data.Entity.Core.Common.CommandTrees.DbCommandTree类的典型用法代码示例。如果您正苦于以下问题:C# DbCommandTree类的具体用法?C# DbCommandTree怎么用?C# DbCommandTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbCommandTree类属于System.Data.Entity.Core.Common.CommandTrees命名空间,在下文中一共展示了DbCommandTree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TreeCreated
public void TreeCreated(DbCommandTree commandTree, DbCommandTreeInterceptionContext interceptionContext)
{
if (interceptionContext.DbContexts.Contains(_context, ReferenceEquals))
{
_commandTrees.Add(commandTree);
}
}
开发者ID:hallco978,项目名称:entityframework,代码行数:7,代码来源:CommandTracer.cs
示例2: CreateCommandDefinition
internal static EntityCommandDefinition CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
{
DebugCheck.NotNull(storeProviderFactory);
DebugCheck.NotNull(commandTree);
return new EntityCommandDefinition(storeProviderFactory, commandTree);
}
开发者ID:jwanagel,项目名称:jjwtest,代码行数:7,代码来源:EntityProviderServices.cs
示例3: 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
示例4: DbCommandInfo
/// <summary>
/// Initializes a new instance of the <see cref="DbCommandInfo"/> class.
/// </summary>
public DbCommandInfo(DbCommandTree tree, DbCache cache, IDbCachingPolicy policy, DbTransactionInterceptor txHandler)
{
Debug.Assert(tree != null);
Debug.Assert(cache != null);
Debug.Assert(txHandler != null);
var qryTree = tree as DbQueryCommandTree;
if (qryTree != null)
{
_isModification = false;
_affectedEntitySets = GetAffectedEntitySets(qryTree.Query);
}
else
{
_isModification = true;
var modify = tree as DbModificationCommandTree;
if (modify != null)
_affectedEntitySets = GetAffectedEntitySets(modify.Target.Expression);
else
// Functions (stored procedures) are not supported.
Debug.Assert(tree is DbFunctionCommandTree);
}
_cache = cache;
_policy = policy;
_txHandler = txHandler;
}
开发者ID:vladisav,项目名称:ignite,代码行数:34,代码来源:DbCommandInfo.cs
示例5: IsQuery_false_for_non_DbQueryCommandTree
public void IsQuery_false_for_non_DbQueryCommandTree()
{
var collectionExpression =
TypeUsage.CreateDefaultTypeUsage(
PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)
.GetCollectionType())
.NewEmptyCollection();
var commandTrees = new DbCommandTree[]
{
new DbInsertCommandTree(
new MetadataWorkspace(),
DataSpace.CSpace,
collectionExpression.Bind(),
new List<DbModificationClause>().AsReadOnly(),
collectionExpression),
new DbUpdateCommandTree(
new MetadataWorkspace(),
DataSpace.CSpace,
collectionExpression.Bind(),
DbExpressionBuilder.Constant(3),
new List<DbModificationClause>().AsReadOnly(),
collectionExpression),
};
foreach (var commandTree in commandTrees)
{
Assert.False(new CommandTreeFacts(commandTree).IsQuery);
}
}
开发者ID:ahmelsayed,项目名称:efcache,代码行数:31,代码来源:CommandTreeFactsTests.cs
示例6: GenerateSQL
public override string GenerateSQL(DbCommandTree tree)
{
DbInsertCommandTree commandTree = tree as DbInsertCommandTree;
InsertStatement statement = new InsertStatement();
DbExpressionBinding e = commandTree.Target;
statement.Target = (InputFragment)e.Expression.Accept(this);
scope.Add("target", statement.Target);
foreach (DbSetClause setClause in commandTree.SetClauses)
statement.Sets.Add(setClause.Property.Accept(this));
if (values == null)
values = new Dictionary<EdmMember, SqlFragment>();
foreach (DbSetClause setClause in commandTree.SetClauses)
{
DbExpression value = setClause.Value;
SqlFragment valueFragment = value.Accept(this);
statement.Values.Add(valueFragment);
if (value.ExpressionKind != DbExpressionKind.Null)
{
EdmMember property = ((DbPropertyExpression)setClause.Property).Property;
values.Add(property, valueFragment);
}
}
if (commandTree.Returning != null)
statement.ReturningSelect = GenerateReturningSql(commandTree, commandTree.Returning);
return statement.ToString();
}
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:35,代码来源:InsertGenerator.cs
示例7: GenerateSQL
public override string GenerateSQL(DbCommandTree commandTree)
{
DbFunctionCommandTree tree = (commandTree as DbFunctionCommandTree);
EdmFunction function = tree.EdmFunction;
CommandType = CommandType.StoredProcedure;
string cmdText = (string)function.MetadataProperties["CommandTextAttribute"].Value;
if (String.IsNullOrEmpty(cmdText))
{
string schema = (string)function.MetadataProperties["Schema"].Value;
if (String.IsNullOrEmpty(schema))
schema = function.NamespaceName;
string functionName = (string)function.MetadataProperties["StoreFunctionNameAttribute"].Value;
if (String.IsNullOrEmpty(functionName))
functionName = function.Name;
return String.Format("`{0}`", functionName);
}
else
{
CommandType = CommandType.Text;
return cmdText;
}
}
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:25,代码来源:FunctionGenerator.cs
示例8: VisitCommandTree
public virtual void VisitCommandTree(DbCommandTree commandTree)
{
Contract.Requires(commandTree != null);
switch (commandTree.CommandTreeKind)
{
case DbCommandTreeKind.Delete:
VisitDeleteCommandTree((DbDeleteCommandTree)commandTree);
break;
case DbCommandTreeKind.Function:
VisitFunctionCommandTree((DbFunctionCommandTree)commandTree);
break;
case DbCommandTreeKind.Insert:
VisitInsertCommandTree((DbInsertCommandTree)commandTree);
break;
case DbCommandTreeKind.Query:
VisitQueryCommandTree((DbQueryCommandTree)commandTree);
break;
case DbCommandTreeKind.Update:
VisitUpdateCommandTree((DbUpdateCommandTree)commandTree);
break;
default:
throw new NotSupportedException();
}
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:29,代码来源:BasicCommandTreeVisitor.cs
示例9: CreateCommandDefinition
internal static EntityCommandDefinition CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
{
Contract.Requires(storeProviderFactory != null);
Contract.Requires(commandTree != null);
return new EntityCommandDefinition(storeProviderFactory, commandTree);
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:EntityProviderServices.cs
示例10: GenerateSQL
public override string GenerateSQL(DbCommandTree tree)
{
DbUpdateCommandTree commandTree = tree as DbUpdateCommandTree;
UpdateStatement statement = new UpdateStatement();
_onReturningSelect = false;
statement.Target = commandTree.Target.Expression.Accept(this);
scope.Add("target", statement.Target as InputFragment);
if (values == null)
values = new Dictionary<EdmMember, SqlFragment>();
foreach (DbSetClause setClause in commandTree.SetClauses)
{
statement.Properties.Add(setClause.Property.Accept(this));
DbExpression value = setClause.Value;
SqlFragment valueFragment = value.Accept(this);
statement.Values.Add(valueFragment);
if (value.ExpressionKind != DbExpressionKind.Null)
{
EdmMember property = ((DbPropertyExpression)setClause.Property).Property;
values.Add(property, valueFragment);
}
}
statement.Where = commandTree.Predicate.Accept(this);
_onReturningSelect = true;
if (commandTree.Returning != null)
statement.ReturningSelect = GenerateReturningSql(commandTree, commandTree.Returning);
return statement.ToString();
}
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:35,代码来源:UpdateGenerator.cs
示例11: ObjectSpanRewriter
/// <summary>
/// Constructs a new ObjectSpanRewriter that will attempt to apply spanning to the specified query
/// (represented as a DbExpression) when <see cref="RewriteQuery" /> is called.
/// </summary>
/// <param name="toRewrite">
/// A <see cref="DbExpression" /> representing the query to span.
/// </param>
internal ObjectSpanRewriter(DbCommandTree tree, DbExpression toRewrite, AliasGenerator aliasGenerator)
{
DebugCheck.NotNull(toRewrite);
_toRewrite = toRewrite;
_tree = tree;
_aliasGenerator = aliasGenerator;
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:15,代码来源:ObjectSpanRewriter.cs
示例12: ValidateDataSpace
/// <summary>
/// Ensures that the data space of the specified command tree is the model (C-) space
/// </summary>
/// <param name="commandTree">The command tree for which the data space should be validated</param>
internal override void ValidateDataSpace(DbCommandTree commandTree)
{
if (commandTree.DataSpace
!= DataSpace.CSpace)
{
throw new ProviderIncompatibleException(Strings.EntityClient_RequiresNonStoreCommandTree);
}
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:12,代码来源:EntityProviderServices.cs
示例13: 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
示例14: 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
示例15: ObjectSpanRewriter
/// <summary>
/// Constructs a new ObjectSpanRewriter that will attempt to apply spanning to the specified query
/// (represented as a DbExpression) when <see cref="RewriteQuery" /> is called.
/// </summary>
/// <param name="toRewrite"> A <see cref="DbExpression" /> representing the query to span. </param>
internal ObjectSpanRewriter(DbCommandTree tree, DbExpression toRewrite, AliasGenerator aliasGenerator)
{
Debug.Assert(toRewrite != null, "Expression to rewrite cannot be null");
_toRewrite = toRewrite;
_tree = tree;
_aliasGenerator = aliasGenerator;
}
开发者ID:junxy,项目名称:entityframework,代码行数:13,代码来源:ObjectSpanRewriter.cs
示例16: ParseResult
internal ParseResult(DbCommandTree commandTree, List<FunctionDefinition> functionDefs)
{
Contract.Requires(commandTree != null);
Contract.Requires(functionDefs != null);
_commandTree = commandTree;
_functionDefs = functionDefs.AsReadOnly();
}
开发者ID:junxy,项目名称:entityframework,代码行数:8,代码来源:ParseResult.cs
示例17: ParseResult
internal ParseResult(DbCommandTree commandTree, List<FunctionDefinition> functionDefs)
{
DebugCheck.NotNull(commandTree);
DebugCheck.NotNull(functionDefs);
_commandTree = commandTree;
_functionDefs = new ReadOnlyCollection<FunctionDefinition>(functionDefs);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:ParseResult.cs
示例18: CreateCommandDefinition
internal static EntityCommandDefinition CreateCommandDefinition(
DbProviderFactory storeProviderFactory, DbCommandTree commandTree, IDbDependencyResolver resolver = null)
{
DebugCheck.NotNull(storeProviderFactory);
DebugCheck.NotNull(commandTree);
return new EntityCommandDefinition(storeProviderFactory, commandTree, resolver);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:EntityProviderServices.cs
示例19: 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
示例20: 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(DbCommandTree commandTree)
{
Contract.Requires(commandTree != null);
ValidateDataSpace(commandTree);
var storeMetadata = (StoreItemCollection)commandTree.MetadataWorkspace.GetItemCollection(DataSpace.SSpace);
Contract.Assert(storeMetadata.StoreProviderManifest != null, "StoreItemCollection has null StoreProviderManifest?");
return CreateDbCommandDefinition(storeMetadata.StoreProviderManifest, commandTree);
}
开发者ID:junxy,项目名称:entityframework,代码行数:17,代码来源:DbProviderServices.cs
注:本文中的System.Data.Entity.Core.Common.CommandTrees.DbCommandTree类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论