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


C# IPropertyMap.GetDataOrItemType方法代码示例

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


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

示例1: MustGetTypeFromPropertyMap

        public virtual Type MustGetTypeFromPropertyMap(IPropertyMap propertyMap)
        {
            Type type = GetTypeFromPropertyMap(propertyMap);

            if (type == null)
                throw new MappingException("Could not find the type " + propertyMap.GetDataOrItemType() + " for the property " + propertyMap.ClassMap.Name + "." + propertyMap.Name + " (found in the map file) in any loaded Assembly!");

            return type;
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:9,代码来源:AssemblyManager.cs

示例2: VerifyReference

 private void VerifyReference(IPropertyMap propertyMap)
 {
     if (propertyMap.ReferenceType != ReferenceType.None)
     {
         if (propertyMap.ReferenceType == ReferenceType.OneToOne || propertyMap.ReferenceType == ReferenceType.OneToMany)
         {
             if (propertyMap.IsCollection)
             {
                 HandleVerifyException(propertyMap, "Reference type must not be set to " + propertyMap.ReferenceType.ToString() + " for a collection property! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Reference type: '" + propertyMap.ReferenceType + "')", "ReferenceType"); // do not localize
             }
             VerifyColumnIsForeignKey(propertyMap);
         }
         else if (propertyMap.ReferenceType == ReferenceType.ManyToOne)
         {
             if (!(propertyMap.IsCollection))
             {
                 HandleVerifyException(propertyMap, "Reference type must not be set to " + propertyMap.ReferenceType.ToString() + " for a non-collection property! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Reference type: '" + propertyMap.ReferenceType + "')", "ReferenceType"); // do not localize
             }
             VerifyIDColumnIsForeignKey(propertyMap);
         }
         else if (propertyMap.ReferenceType == ReferenceType.ManyToMany)
         {
             if (!(propertyMap.IsCollection))
             {
                 HandleVerifyException(propertyMap, "Reference type must not be set to " + propertyMap.ReferenceType.ToString() + " for a non-collection property! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Reference type: '" + propertyMap.ReferenceType + "')", "ReferenceType"); // do not localize
             }
             VerifyColumnIsForeignKey(propertyMap);
             VerifyIDColumnIsForeignKey(propertyMap);
         }
         IClassMap referencedClassMap = propertyMap.GetReferencedClassMap() ;
         if (referencedClassMap == null)
         {
             HandleVerifyException(propertyMap, "Reference type class not found! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Referenced class: '" + propertyMap.DataType + "')", "DataType"); // do not localize
         }
         else
         {
             if (referencedClassMap.ClassType == ClassType.Interface)
             {
                 HandleVerifyException(propertyMap, "Persistent reference properties can not use interfaces as types! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Type: '" + propertyMap.GetDataOrItemType() + "')", "DataType"); // do not localize
             }
             else if (referencedClassMap.ClassType == ClassType.Struct)
             {
                 HandleVerifyException(propertyMap, "Persistent reference properties can not use structs as types! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Type: '" + propertyMap.GetDataOrItemType() + "')", "DataType"); // do not localize
             }
             else if (referencedClassMap.ClassType == ClassType.Enum)
             {
                 HandleVerifyException(propertyMap, "Reference type should be set to None for properties with enumeration types! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Type: '" + propertyMap.GetDataOrItemType() + "')", "ReferenceType"); // do not localize
             }
         }
     }
     else
     {
         if (!(propertyMap.ReferenceType == ReferenceType.None))
         {
             HandleVerifyException(propertyMap, "Reference type must be set None for non-reference properties! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Reference type: '" + propertyMap.ReferenceType + "')", "DataType"); // do not localize
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:58,代码来源:MapVerificationVisitor.cs

示例3: GetTypeFromPropertyMap

        public virtual Type GetTypeFromPropertyMap(IPropertyMap propertyMap)
        {
            Type type = null;
            string dataType = propertyMap.GetDataOrItemType() ;
            IClassMap classMap = propertyMap.ClassMap.DomainMap.GetClassMap(dataType);
            if (classMap != null)
            {
                type = Type.GetType(classMap.GetFullName() + ", " + classMap.GetAssemblyName());
                if (type == null)
                {
                    foreach (Assembly asm in m_LoadedAssemblies.Values)
                    {
                        type = asm.GetType(classMap.GetFullName());
                        if (type != null)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                type = Type.GetType(dataType);
                if (type == null)
                {
                    IDomainMap domainMap = propertyMap.ClassMap.DomainMap;
                    string fullName = dataType;
                    if (domainMap.RootNamespace.Length > 0)
                        fullName = domainMap.RootNamespace + "." + fullName;

                    type = Type.GetType(fullName + ", " + domainMap.GetAssemblyName());
                }
            }
            return type;
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:35,代码来源:AssemblyManager.cs


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