예제 #1
0
        /// <summary>
        /// Gets a value whether the current property is an identity or not.
        /// </summary>
        /// <returns>True if the current property is an identity.</returns>
        public bool?IsIdentity()
        {
            if (m_isIdentity != null)
            {
                return(m_isIdentity);
            }

            // Identity Attribute
            m_isIdentity = (GetIdentityAttribute() != null);
            if (m_isIdentity == true)
            {
                return(m_isIdentity);
            }

            // PrimaryMapper
            var classProperty = IdentityMapper.Get(GetDeclaringType());

            m_isIdentity = (classProperty == this);
            if (m_isIdentity == true)
            {
                return(m_isIdentity);
            }

            // Return false
            return(m_isIdentity = false);
        }
 /// <summary>
 /// Defines the data entity type identity property (via <see cref="Field"/> object).
 /// </summary>
 /// <param name="field">The instance of <see cref="Field"/> object to be mapped.</param>
 /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param>
 /// <returns>The current instance.</returns>
 public EntityMapFluentDefinition <TEntity> Identity(Field field,
                                                     bool force)
 {
     IdentityMapper.Add <TEntity>(field, force);
     return(this);
 }
 /// <summary>
 /// Defines the data entity type identity property.
 /// </summary>
 /// <param name="expression">The expression to be parsed.</param>
 /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param>
 /// <returns>The current instance.</returns>
 public EntityMapFluentDefinition <TEntity> Identity(Expression <Func <TEntity, object> > expression,
                                                     bool force)
 {
     IdentityMapper.Add <TEntity>(expression, force);
     return(this);
 }
 /// <summary>
 /// Defines the data entity type identity property (via property name).
 /// </summary>
 /// <param name="propertyName">The name of the class property to be mapped.</param>
 /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param>
 /// <returns>The current instance.</returns>
 public EntityMapFluentDefinition <TEntity> Identity(string propertyName,
                                                     bool force)
 {
     IdentityMapper.Add <TEntity>(propertyName, force);
     return(this);
 }
예제 #5
0
 protected IIdentityOptions <T> Identity(Expression <Func <T, object> > expression)
 {
     IdentityMapper.Add <T>(expression);
     return(new IdentityOptions <T>(expression));
 }