Beispiel #1
0
        static DbRecord()
        {
            var type = typeof(T);

            m_Table    = GetTableAttribute(type);
            m_Sequence = GetSequenceAttribute(type);
            m_Columns  = GetColumnAttributes(type);

            m_PrimaryColumns = m_Columns
                               .Where(c => c.Value.IsPrimaryKey)
                               .ToArray();

            m_IdentityColumn = m_Columns
                               .FirstOrDefault(c => c.Value.IsDbGenerated);

            if (m_IdentityColumn.Value != null)
            {
                m_IsIdentity32 = m_Accessor.GetPropertyInfo(m_IdentityColumn.Key).PropertyType == typeof(int);
            }

            m_CompareTo = EntityHelper.CompareTo <T>(m_PrimaryColumns.Select(p => p.Key).ToArray()); // optional case sensitive?
            m_Equals    = EntityHelper.Equals <T>(m_PrimaryColumns.Select(p => p.Key).ToArray());    // optional case sensitive?
            m_Hasher    = EntityHelper.GetHashCode <T>(m_PrimaryColumns.Select(p => p.Key).ToArray());
        }