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


C# Mapping.GetAccessorPropertyName方法代码示例

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


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

示例1: GetPropertyAccessor

		//TODO: ideally we need the construction of PropertyAccessor to take the following:
		//      1) EntityMode
		//      2) EntityMode-specific data (i.e., the classname for pojo entities)
		//      3) Property-specific data based on the EntityMode (i.e., property-name or dom4j-node-name)
		// The easiest way, with the introduction of the new runtime-metamodel classes, would be the
		// the following predicates:
		//      1) PropertyAccessorFactory.getPropertyAccessor() takes references to both a
		//          org.hibernate.metadata.EntityModeMetadata and org.hibernate.metadata.Property
		//      2) What is now termed a "PropertyAccessor" stores any values needed from those two
		//          pieces of information
		//      3) Code can then simply call PropertyAccess.getGetter() with no parameters; likewise with
		//          PropertyAccessor.getSetter()

		/// <summary> Retrieves a PropertyAccessor instance based on the given property definition and entity mode. </summary>
		/// <param name="property">The property for which to retrieve an accessor. </param>
		/// <param name="mode">The mode for the resulting entity. </param>
		/// <returns> An appropriate accessor. </returns>
		public static IPropertyAccessor GetPropertyAccessor(Mapping.Property property, EntityMode? mode)
		{
			//TODO: this is temporary in that the end result will probably not take a Property reference per-se.
			EntityMode modeToUse = mode.HasValue ? mode.Value : EntityMode.Poco;
			switch(modeToUse)
			{
				case EntityMode.Poco:
					return GetPocoPropertyAccessor(property.PropertyAccessorName);
				case EntityMode.Map:
					return DynamicMapPropertyAccessor;
				case EntityMode.Xml:
					return GetXmlPropertyAccessor(property.GetAccessorPropertyName(modeToUse), property.Type, null);
				default:
					throw new MappingException("Unknown entity mode [" + mode + "]");
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:33,代码来源:PropertyAccessorFactory.cs


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