当前位置: 首页>>代码示例>>C#>>正文


C# StructuralType.GetDeclaredOnlyMembers方法代码示例

本文整理汇总了C#中StructuralType.GetDeclaredOnlyMembers方法的典型用法代码示例。如果您正苦于以下问题:C# StructuralType.GetDeclaredOnlyMembers方法的具体用法?C# StructuralType.GetDeclaredOnlyMembers怎么用?C# StructuralType.GetDeclaredOnlyMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StructuralType的用法示例。


在下文中一共展示了StructuralType.GetDeclaredOnlyMembers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryFindAndCreatePrimitiveProperties

 private bool TryFindAndCreatePrimitiveProperties(
     Type type, StructuralType cspaceType, StructuralType ospaceType, IEnumerable<PropertyInfo> clrProperties)
 {
     foreach (
         var cspaceProperty in
             cspaceType.GetDeclaredOnlyMembers<EdmProperty>().Where(p => Helper.IsPrimitiveType(p.TypeUsage.EdmType)))
     {
         var clrProperty = clrProperties.FirstOrDefault(p => MemberMatchesByConvention(p, cspaceProperty));
         if (clrProperty != null)
         {
             PrimitiveType propertyType;
             if (TryGetPrimitiveType(clrProperty.PropertyType, out propertyType))
             {
                 if (clrProperty.CanRead
                     && clrProperty.CanWriteExtended())
                 {
                     AddScalarMember(type, clrProperty, ospaceType, cspaceProperty, propertyType);
                 }
                 else
                 {
                     var message = Strings.Validator_OSpace_Convention_ScalarPropertyMissginGetterOrSetter(
                         clrProperty.Name, type.FullName, type.Assembly().FullName);
                     LogLoadMessage(message, cspaceType);
                     return false;
                 }
             }
             else
             {
                 var message = Strings.Validator_OSpace_Convention_NonPrimitiveTypeProperty(
                     clrProperty.Name, type.FullName, clrProperty.PropertyType.FullName);
                 LogLoadMessage(message, cspaceType);
                 return false;
             }
         }
         else
         {
             var message = Strings.Validator_OSpace_Convention_MissingRequiredProperty(cspaceProperty.Name, type.FullName);
             LogLoadMessage(message, cspaceType);
             return false;
         }
     }
     return true;
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:43,代码来源:OSpaceTypeFactory.cs

示例2: TryFindAndCreateEnumProperties

        private bool TryFindAndCreateEnumProperties(
            Type type, StructuralType cspaceType, StructuralType ospaceType, IEnumerable<PropertyInfo> clrProperties,
            List<Action> referenceResolutionListForCurrentType)
        {
            var typeClosureToTrack = new List<KeyValuePair<EdmProperty, PropertyInfo>>();

            foreach (
                var cspaceProperty in cspaceType.GetDeclaredOnlyMembers<EdmProperty>().Where(p => Helper.IsEnumType(p.TypeUsage.EdmType)))
            {
                var clrProperty = clrProperties.FirstOrDefault(p => MemberMatchesByConvention(p, cspaceProperty));
                if (clrProperty != null)
                {
                    typeClosureToTrack.Add(new KeyValuePair<EdmProperty, PropertyInfo>(cspaceProperty, clrProperty));
                }
                else
                {
                    var message = Strings.Validator_OSpace_Convention_MissingRequiredProperty(cspaceProperty.Name, type.FullName);
                    LogLoadMessage(message, cspaceType);
                    return false;
                }
            }

            foreach (var typeToTrack in typeClosureToTrack)
            {
                TrackClosure(typeToTrack.Value.PropertyType);
                // prevent the lifting of these closure variables
                var ot = ospaceType;
                var cp = typeToTrack.Key;
                var clrp = typeToTrack.Value;
                referenceResolutionListForCurrentType.Add(() => CreateAndAddEnumProperty(type, ot, cp, clrp));
            }

            return true;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:34,代码来源:OSpaceTypeFactory.cs

示例3: TryFindNavigationProperties

        private bool TryFindNavigationProperties(
            Type type, StructuralType cspaceType, StructuralType ospaceType, IEnumerable<PropertyInfo> clrProperties,
            List<Action> referenceResolutionListForCurrentType)
        {
            var typeClosureToTrack =
                new List<KeyValuePair<NavigationProperty, PropertyInfo>>();
            foreach (var cspaceProperty in cspaceType.GetDeclaredOnlyMembers<NavigationProperty>())
            {
                var clrProperty = clrProperties.FirstOrDefault(p => NonPrimitiveMemberMatchesByConvention(p, cspaceProperty));
                if (clrProperty != null)
                {
                    var needsSetter = cspaceProperty.ToEndMember.RelationshipMultiplicity != RelationshipMultiplicity.Many;
                    if (clrProperty.CanRead
                        && (!needsSetter || clrProperty.CanWriteExtended()))
                    {
                        typeClosureToTrack.Add(
                            new KeyValuePair<NavigationProperty, PropertyInfo>(
                                cspaceProperty, clrProperty));
                    }
                }
                else
                {
                    var message = Strings.Validator_OSpace_Convention_MissingRequiredProperty(
                        cspaceProperty.Name, type.FullName);
                    LogLoadMessage(message, cspaceType);
                    return false;
                }
            }

            foreach (var typeToTrack in typeClosureToTrack)
            {
                TrackClosure(typeToTrack.Value.PropertyType);

                // keep from lifting these closure variables
                var ct = cspaceType;
                var ot = ospaceType;
                var cp = typeToTrack.Key;

                referenceResolutionListForCurrentType.Add(() => CreateAndAddNavigationProperty(ct, ot, cp));
            }

            return true;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:43,代码来源:OSpaceTypeFactory.cs


注:本文中的StructuralType.GetDeclaredOnlyMembers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。