Inheritance: IIdentityMappingProvider
Esempio n. 1
0
        public virtual IdentityPart Id(Expression <Func <T, object> > memberExpression, string column)
        {
            IdentityPart identityPart = new IdentityPart(this.EntityType, ReflectionExtensions.ToMember <T, object>(memberExpression));

            if (column != null)
            {
                identityPart.Column(column);
            }
            this.providers.Id = (IIdentityMappingProvider)identityPart;
            return(identityPart);
        }
Esempio n. 2
0
        public IdentityPart Id <TId>(string column)
        {
            IdentityPart identityPart = new IdentityPart(typeof(T), typeof(TId));

            if (column != null)
            {
                identityPart.SetName(column);
                identityPart.Column(column);
            }
            this.providers.Id = (IIdentityMappingProvider)identityPart;
            return(identityPart);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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 IdentityPart Id(Expression <Func <T, object> > memberExpression, string column)
        {
            var member = memberExpression.ToMember();

            OnMemberMapped(member);

            var part = new IdentityPart(EntityType, member);

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

            providers.Id = part;

            return(part);
        }
Esempio n. 7
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();

#pragma warning disable 612,618
            var part = new IdentityPart(EntityType, member);
#pragma warning restore 612,618

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

            providers.Id = part;

            return(part);
        }
Esempio n. 8
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 IdentityPart Id(Expression <Func <T, object> > memberExpression, string column)
        {
            var member = memberExpression.ToMember();

            OnMemberMapped(member);

            var part = new IdentityPart(EntityType, member);

            //PROTOTYPE1: ADDED
            if (this.UseBackingField(member.Name))
            {
                part.Access.CamelCaseField(Prefix.Underscore);
            }
            //PROTOTYPE1: ADDED

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

            providers.Id = part;

            return(part);
        }
        public void Scratch()
        {
            PropertyInfo property = ReflectionHelper.GetProperty<IdentityTarget>(x => x.IntId);
            var id = new IdentityPart(typeof(IdentityTarget), property);

            var document = new XmlDocument();
            var element = document.CreateElement("root");
            id.Write(element, new MappingVisitor());
            Debug.Write(element.InnerXml);
        }