本文整理汇总了C#中IEdmModel.FindDeclaredOperations方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.FindDeclaredOperations方法的具体用法?C# IEdmModel.FindDeclaredOperations怎么用?C# IEdmModel.FindDeclaredOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmModel
的用法示例。
在下文中一共展示了IEdmModel.FindDeclaredOperations方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillStockContentsForEntityContainer
private void FillStockContentsForEntityContainer(IEdmEntityContainer edmContainer, IEdmModel edmModel, EdmModel stockModel)
{
var stockContainer = (EdmEntityContainer)stockModel.FindEntityContainer(edmContainer.FullName());
this.SetImmediateAnnotations(edmContainer, stockContainer, edmModel, stockModel);
foreach (var edmNavigationSource in edmContainer.Elements.OfType<IEdmNavigationSource>())
{
var stockEntityType = (EdmEntityType)stockModel.FindType(GetFullName(edmNavigationSource.EntityType()));
if (edmNavigationSource is IEdmSingleton)
{
stockContainer.AddSingleton(edmNavigationSource.Name, stockEntityType);
}
else
{
stockContainer.AddEntitySet(edmNavigationSource.Name, stockEntityType);
}
}
foreach (var stockNavigationSource in stockContainer.Elements.OfType<EdmNavigationSource>())
{
var stockEntityType = (EdmEntityType)stockModel.FindType(GetFullName(stockNavigationSource.EntityType()));
IEdmNavigationSource edmNavigationSource = edmContainer.FindEntitySet(stockNavigationSource.Name);
if (edmNavigationSource == null)
{
edmNavigationSource = edmContainer.FindSingleton(stockNavigationSource.Name);
}
var stockDerivedNavigations = GetAllNavigationFromDerivedTypesAndSelf(stockEntityType, stockModel);
foreach (var stockNavigationProperty in stockDerivedNavigations)
{
var edmNavigationProperty = edmNavigationSource.NavigationPropertyBindings.Select(n => n.NavigationProperty).SingleOrDefault(n => n.Name == stockNavigationProperty.Name);
if (edmNavigationProperty != null)
{
var targetEdmEntitySet = edmNavigationSource.FindNavigationTarget(edmNavigationProperty);
if (null != targetEdmEntitySet)
{
var targetEntitySetFromContainer = stockContainer.Elements.OfType<EdmEntitySet>().SingleOrDefault
(
n =>
GetBaseTypesAndSelf(((IEdmNavigationProperty)stockNavigationProperty).ToEntityType()).Select(m => GetFullName(m)).Contains(n.EntityType().FullName()) && n.Name == targetEdmEntitySet.Name
);
if (null == targetEntitySetFromContainer)
{
targetEntitySetFromContainer = stockContainer.Elements.OfType<EdmEntitySet>().SingleOrDefault
(
n =>
GetAllDerivedTypesAndSelf(((IEdmNavigationProperty)stockNavigationProperty).ToEntityType(), stockModel).Select(m => GetFullName(m)).Contains(n.EntityType().FullName()) && n.Name == targetEdmEntitySet.Name
);
}
stockNavigationSource.AddNavigationTarget(stockNavigationProperty, targetEntitySetFromContainer);
}
}
}
}
foreach (var edmOperationImport in edmContainer.OperationImports())
{
EdmOperationImport stockEdmOperationImport = null;
var edmActionImport = edmOperationImport as IEdmActionImport;
if (edmActionImport != null)
{
var newEdmAction = stockModel.FindDeclaredOperations(edmActionImport.Action.FullName()).OfType<IEdmAction>().FirstOrDefault() as EdmAction;
ExceptionUtilities.CheckObjectNotNull(newEdmAction, "cannot find action");
stockEdmOperationImport = stockContainer.AddActionImport(edmOperationImport.Name, newEdmAction, edmActionImport.EntitySet);
}
else
{
IEdmFunctionImport edmFunctionImport = edmOperationImport as IEdmFunctionImport;
ExceptionUtilities.CheckArgumentNotNull(edmFunctionImport, "edmFunctionImport");
var newEdmFunction = edmModel.FindDeclaredOperations(edmFunctionImport.Function.FullName()).OfType<IEdmFunction>().FirstOrDefault();
ExceptionUtilities.CheckObjectNotNull(newEdmFunction, "Expected to find an function: " + edmFunctionImport.Function.FullName());
stockEdmOperationImport = stockContainer.AddFunctionImport(edmFunctionImport.Name, newEdmFunction, edmFunctionImport.EntitySet, edmFunctionImport.IncludeInServiceDocument);
}
this.SetImmediateAnnotations(edmOperationImport, stockEdmOperationImport, edmModel, stockModel);
}
}
示例2: GetMetadataReferenceName
internal static string GetMetadataReferenceName(IEdmModel model, IEdmOperation operation)
{
Debug.Assert(operation != null, "operation != null");
string metadataReferenceName = operation.FullName();
bool hasOverload = model.FindDeclaredOperations(operation.FullName()).Take(2).Count() > 1;
if (hasOverload)
{
if (operation is IEdmFunction)
{
metadataReferenceName = operation.FullNameWithNonBindingParameters();
}
}
return metadataReferenceName;
}
示例3: AssertEntityOperation
private static void AssertEntityOperation(IEdmModel edmModel, string operationName)
{
IEdmOperation entityFunc = Assert.Single(edmModel.FindDeclaredOperations(operationName));
Assert.Equal(4, entityFunc.Parameters.Count());
IEdmOperationParameter parameter = Assert.Single(entityFunc.Parameters.Where(e => e.Name == "person"));
Assert.Equal("NS.Employee", parameter.Type.FullName());
Assert.False(parameter.Type.IsNullable);
parameter = Assert.Single(entityFunc.Parameters.Where(e => e.Name == "guard"));
Assert.Equal("NS.Employee", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
parameter = Assert.Single(entityFunc.Parameters.Where(e => e.Name == "staff"));
Assert.Equal("Collection(NS.Employee)", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
}
示例4: AssertComplexOperation
private static void AssertComplexOperation(IEdmModel edmModel, string operationName)
{
IEdmOperation complexFunc = Assert.Single(edmModel.FindDeclaredOperations(operationName));
Assert.Equal(4, complexFunc.Parameters.Count());
IEdmOperationParameter parameter = Assert.Single(complexFunc.Parameters.Where(e => e.Name == "address"));
Assert.Equal("NS.Address", parameter.Type.FullName());
Assert.False(parameter.Type.IsNullable);
parameter = Assert.Single(complexFunc.Parameters.Where(e => e.Name == "location"));
Assert.Equal("NS.Address", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
parameter = Assert.Single(complexFunc.Parameters.Where(e => e.Name == "addresses"));
Assert.Equal("Collection(NS.Address)", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
}
示例5: AssertEnumOperation
private static void AssertEnumOperation(IEdmModel edmModel, string operationName)
{
IEdmOperation enumFunc = Assert.Single(edmModel.FindDeclaredOperations(operationName));
Assert.Equal(4, enumFunc.Parameters.Count());
IEdmOperationParameter parameter = Assert.Single(enumFunc.Parameters.Where(e => e.Name == "bkColor"));
Assert.Equal("NS.Color", parameter.Type.FullName());
Assert.False(parameter.Type.IsNullable);
parameter = Assert.Single(enumFunc.Parameters.Where(e => e.Name == "frColor"));
Assert.Equal("NS.Color", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
parameter = Assert.Single(enumFunc.Parameters.Where(e => e.Name == "colors"));
Assert.Equal("Collection(NS.Color)", parameter.Type.FullName());
Assert.False(parameter.Type.IsNullable);
}
示例6: AssertPrimitiveOperation
private static void AssertPrimitiveOperation(IEdmModel edmModel, string opertionName)
{
IEdmOperation primitiveFunc = Assert.Single(edmModel.FindDeclaredOperations(opertionName));
Assert.Equal(5, primitiveFunc.Parameters.Count());
IEdmOperationParameter parameter = Assert.Single(primitiveFunc.Parameters.Where(e => e.Name == "param"));
Assert.Equal("Edm.Int32", parameter.Type.FullName());
Assert.False(parameter.Type.IsNullable);
parameter = Assert.Single(primitiveFunc.Parameters.Where(e => e.Name == "price"));
Assert.Equal("Edm.Double", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
parameter = Assert.Single(primitiveFunc.Parameters.Where(e => e.Name == "name"));
Assert.Equal("Edm.String", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
parameter = Assert.Single(primitiveFunc.Parameters.Where(e => e.Name == "names"));
Assert.Equal("Collection(Edm.String)", parameter.Type.FullName());
Assert.True(parameter.Type.IsNullable);
}