private string TableOf(Type type)
 {
   var name = type
     .GetCustomAttributes(typeof (TableMappingAttribute), false)
     .Cast<TableMappingAttribute>()
     .Single().Name;
   return nameBuilder.ApplyNamingRules(name);
 }
Esempio n. 2
0
        private bool EnsureFieldExist(StoredTypeInfo type, string fieldName)
        {
            if (!EnsureTableExist(type))
            {
                return(false);
            }
            var nodeName        = GetTableName(type);
            var actualFieldName = nameBuilder.ApplyNamingRules(fieldName);

            if (extractedStorageModel.Tables[nodeName].Columns.Contains(actualFieldName))
            {
                return(true);
            }
            UpgradeLog.Warning(Strings.ExColumnXIsNotFoundInTableY, actualFieldName, nodeName);
            return(false);
        }
        private string GetColumnPath(StoredTypeInfo type, string columnName)
        {
            var nodeName = GetTableName(type);
            // Due to current implementation of domain model FieldInfo.MappingName is not correct,
            // it has naming rules unapplied, corresponding ColumnInfo.Name however is correct.
            // StoredFieldInfo.MappingName is taken directly from FieldInfo.MappingName and thus is incorrect too.
            // We need to apply naming rules here to make it work.
            var actualColumnName = nameBuilder.ApplyNamingRules(columnName);

            return(string.Format("Tables/{0}/Columns/{1}", nodeName, actualColumnName));
        }