DbExpressionBuilder.NewEmptyCollection 方法
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
创建一个新的 DbNewInstanceExpression,它构造指定集合类型的空集合。
命名空间: System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
<ExtensionAttribute> _
Public Shared Function NewEmptyCollection ( _
collectionType As TypeUsage _
) As DbNewInstanceExpression
用法
Dim collectionType As TypeUsage
Dim returnValue As DbNewInstanceExpression
returnValue = collectionType.NewEmptyCollection()
public static DbNewInstanceExpression NewEmptyCollection(
this TypeUsage collectionType
)
[ExtensionAttribute]
public:
static DbNewInstanceExpression^ NewEmptyCollection(
TypeUsage^ collectionType
)
static member NewEmptyCollection :
collectionType:TypeUsage -> DbNewInstanceExpression
public static function NewEmptyCollection(
collectionType : TypeUsage
) : DbNewInstanceExpression
参数
- collectionType
类型:System.Data.Entity.Core.Metadata.Edm.TypeUsage
要创建的集合的类型元数据。
返回值
类型:System.Data.Entity.Core.Common.CommandTrees.DbNewInstanceExpression
具有指定的集合类型和空 Arguments 列表的一个新的 DbNewInstanceExpression。
使用说明
在 Visual Basic 和 C# 中,可以在 TypeUsage 类型的任何对象上将此方法作为实例方法来调用。当使用实例方法语法调用此方法时,请省略第一个参数。有关详细信息,请参阅https://msdn.microsoft.com/zh-cn/library/bb384936(v=vs.113)或https://msdn.microsoft.com/zh-cn/library/bb383977(v=vs.113)。
异常
例外 | 条件 |
---|---|
ArgumentNullException | collectionType 为 null。 |
ArgumentException | collectionType 不是集合类型。 |
请参阅
参考
System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder 命名空间