Example #1
0
        public virtual IdentityPart Id <TColumn>(string column)
        {
            var part = new IdentityPart(typeof(T), typeof(TColumn), column);

            if (column != null)
            {
                part.Column(column);
            }

            id = part;

            return(part);
        }
Example #2
0
        /// <summary>
        /// Create an Id that doesn't have a corresponding property in
        /// the domain object.
        /// </summary>
        /// <typeparam name="TId">Type of the id</typeparam>
        /// <param name="column">Name and column name of the id</param>
        public IdentityPart Id <TId>(string column)
        {
            var part = new IdentityPart(typeof(T), typeof(TId));

            if (column != null)
            {
                part.SetName(column);
                part.Column(column);
            }

            id = part;

            return(part);
        }
Example #3
0
        /// <summary>
        /// Specify the identifier for this entity.
        /// </summary>
        /// <param name="memberExpression">Identity property</param>
        /// <param name="column">Column name</param>
        /// <example>
        /// Id(x => x.PersonId, "id");
        /// </example>
        public virtual IdentityPart Id(Expression <Func <T, object> > memberExpression, string column)
        {
            var member = memberExpression.ToMember();
            var part   = new IdentityPart(EntityType, member);

            if (column != null)
            {
                part.Column(column);
            }

            id = part;

            return(part);
        }
Example #4
0
        public virtual IdentityPart Id(Expression <Func <T, object> > expression, string column)
        {
            Member property = ReflectionHelper.GetProperty(expression).ToMember();
            var    part     = column == null ? new IdentityPart(EntityType, property) : new IdentityPart(EntityType, property);

            if (column != null)
            {
                part.Column(column);
            }

            id = part;

            return(part);
        }