Пример #1
0
        /// <summary>
        /// Gets a mapped column name
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dbCtx"></param>
        /// <param name="obj"></param>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        public static string GetTableColumnName <T>(this Microsoft.EntityFrameworkCore.DbContext dbCtx, T obj, string propertyName)
        {
            var metaData = dbCtx.GetEntityMetadata(obj);

            return(metaData.GetProperties().FirstOrDefault(p => p.Name == propertyName)?.GetColumnName());
        }