Exemple #1
0
        private void GetTableData()
        {
            TableMapping = Mapper.GetTableMapping <T>();
            TableNameAttribute tableNameAtt = typeof(T).GetTypeInfo().GetCustomAttribute <TableNameAttribute>();

            TableName = tableNameAtt != null ? tableNameAtt.TableName : typeof(T).Name + "s";
            alias     = TableName.First().ToString().ToLower();
        }
Exemple #2
0
        private void GetTableData()
        {
            TableMapping = new Dictionary <string, string>();
            PropertyInfo[] properties = typeof(T).GetTypeInfo().GetProperties();
            foreach (PropertyInfo p in properties)
            {
                NotMappedAttribute nm = p.GetCustomAttribute <NotMappedAttribute>();
                if (nm == null)
                {
                    ColumnNameAttribute cma = p.GetCustomAttribute <ColumnNameAttribute>();
                    TableMapping.Add(p.Name, cma != null ? cma.ColumnName : p.Name);
                }
            }
            TableNameAttribute tableNameAtt = typeof(T).GetTypeInfo().GetCustomAttribute <TableNameAttribute>();

            TableName = tableNameAtt != null ? tableNameAtt.TableName : typeof(T).Name + "s";
            alias     = TableName.First().ToString().ToLower();
        }