private static void ResolveTableInfo(SimpleDataDescriptor descriptor, Type type) { var tableAttributes = type.GetCustomAttributes(typeof(TableAttribute), true); if (tableAttributes.Length > 0 && tableAttributes[0] is TableAttribute attribute) { descriptor.Table = TableNameConvention?.Invoke(attribute.Name) ?? attribute.Name; descriptor.Schema = attribute.Schema; } else { descriptor.Table = TableNameConvention?.Invoke(type.GetNonGenericName()) ?? type.GetNonGenericName(); } }
public static SimpleDataDescriptor Create(Type type) { lock (Descriptors) { var obj = (SimpleDataDescriptor)Descriptors[type]; if (obj != null) { return(obj); } obj = (SimpleDataDescriptor)Descriptors[type]; if (obj != null) { return(obj); } obj = new SimpleDataDescriptor(type); Descriptors[type] = obj; return(obj); } }