/// <summary> /// 注册特殊的实体属性,这类属性为附加自实体间关系的不可持久化的属性。 /// </summary> /// <typeparam name="TEntity">实体的类型。</typeparam> /// <param name="expression">指定注册的属性的表达式。</param> /// <param name="referenceProperty">参数或引用的属性。</param> /// <param name="options">关联选项。</param> /// <returns>一个 <see cref="IProperty"/> 对象。</returns> public static IProperty RegisterSupposedProperty <TEntity>(Expression <Func <TEntity, object> > expression, IProperty referenceProperty = null, RelationOptions options = null) where TEntity : IEntity { var propertyInfo = PropertySearchVisitor.FindProperty(expression); if (propertyInfo == null) { throw new InvalidOperationException(SR.GetString(SRKind.InvalidRegisterExpression)); } return(RegisterSupposedProperty(propertyInfo, typeof(TEntity), referenceProperty, options)); }
/// <summary> /// 注册基本的实体属性。 /// </summary> /// <typeparam name="TEntity">实体的类型。</typeparam> /// <param name="expression">指定注册的属性的表达式。</param> /// <param name="info">属性映射信息。</param> /// <returns>一个 <see cref="IProperty"/> 对象。</returns> public static IProperty RegisterProperty <TEntity>(Expression <Func <TEntity, object> > expression, PropertyMapInfo info = null) where TEntity : IEntity { var propertyInfo = PropertySearchVisitor.FindProperty(expression); if (propertyInfo == null) { throw new InvalidOperationException(SR.GetString(SRKind.InvalidRegisterExpression)); } return(RegisterProperty(propertyInfo, typeof(TEntity), info)); }