Example #1
0
        public virtual CompositeIdentityPart <TId> CompositeId <TId>(Expression <Func <T, TId> > memberExpression)
        {
            CompositeIdentityPart <TId> compositeIdentityPart = new CompositeIdentityPart <TId>(ReflectionExtensions.ToMember <T, TId>(memberExpression).Name);

            this.providers.CompositeId = (ICompositeIdMappingProvider)compositeIdentityPart;
            return(compositeIdentityPart);
        }
Example #2
0
        public virtual CompositeIdentityPart <T> CompositeId()
        {
            CompositeIdentityPart <T> compositeIdentityPart = new CompositeIdentityPart <T>();

            this.providers.CompositeId = (ICompositeIdMappingProvider)compositeIdentityPart;
            return(compositeIdentityPart);
        }
Example #3
0
        /// <summary>
        /// Create a composite identity represented by an identity class. This is an
        /// identity composed of multiple columns.
        /// Note: Prefer using a surrogate key over a composite key whenever possible.
        /// </summary>
        /// <param name="memberExpression">Composite id property</param>
        /// <example>
        /// CompositeId(x => x.Id)
        ///   .KeyProperty(x => x.FirstName)
        ///   .KeyProperty(x => x.LastName);
        /// </example>
        public virtual CompositeIdentityPart <TId> CompositeId <TId>(Expression <Func <T, TId> > memberExpression)
        {
            var part = new CompositeIdentityPart <TId>(memberExpression.ToMember().Name);

            compositeId = part;

            return(part);
        }
Example #4
0
        /// <summary>
        /// Create a composite identity. This is an identity composed of multiple
        /// columns.
        /// Note: Prefer using a surrogate key over a composite key whenever possible.
        /// </summary>
        /// <example>
        /// CompositeId()
        ///   .KeyProperty(x => x.FirstName)
        ///   .KeyProperty(x => x.LastName);
        /// </example>
        public virtual CompositeIdentityPart <T> CompositeId()
        {
            var part = new CompositeIdentityPart <T>();

            compositeId = part;

            return(part);
        }
Example #5
0
        /// <summary>
        /// Create a composite identity. This is an identity composed of multiple
        /// columns.
        /// Note: Prefer using a surrogate key over a composite key whenever possible.
        /// </summary>
        /// <example>
        /// CompositeId()
        ///   .KeyProperty(x => x.FirstName)
        ///   .KeyProperty(x => x.LastName);
        /// </example>
        public CompositeIdentityPart <T> CompositeId()
        {
            var part = new CompositeIdentityPart <T>(OnMemberMapped);

            providers.CompositeId = part;

            return(part);
        }
Example #6
0
        public virtual CompositeIdentityPart <TId> CompositeId <TId>(Expression <Func <T, TId> > expression)
        {
            var part = new CompositeIdentityPart <TId>(ReflectionHelper.GetProperty(expression).Name);

            compositeId = part;

            return(part);
        }
Example #7
0
        /// <summary>
        /// Create a composite identity represented by an identity class. This is an
        /// identity composed of multiple columns.
        /// Note: Prefer using a surrogate key over a composite key whenever possible.
        /// </summary>
        /// <param name="memberExpression">Composite id property</param>
        /// <example>
        /// CompositeId(x => x.Id)
        ///   .KeyProperty(x => x.FirstName)
        ///   .KeyProperty(x => x.LastName);
        /// </example>
        public CompositeIdentityPart <TId> CompositeId <TId>(Expression <Func <T, TId> > memberExpression)
        {
            var member = memberExpression.ToMember();

            OnMemberMapped(member);

            var part = new CompositeIdentityPart <TId>(member.Name, OnMemberMapped);

            providers.CompositeId = part;

            return(part);
        }