public static void SetRawModel(Type type, IMutableModel model, IShamanLogger logger) { void Log(string message) { logger.Log(typeof(ModelsCachedContainer), nameof(SetRawModel), message); } string MutableEntityTypeToString(IMutableEntityType mutableEntityType) { try { var r = mutableEntityType.Relational(); return($"{r.Schema}.{r.TableName}"); } catch (Exception e) { logger.LogException(Guid.Parse("{22CC8890-B871-45BF-890E-9341B41183F6}"), e); return("??"); } } var value = EfModelWrapper.FromModel(model); var result = Cache.TryAdd(type, value); Log(result ? "Success" : "Skipped"); }
private static string GetDeclaringTypeFullName(MethodBase method, IShamanLogger logger) { try { return(method.DeclaringType?.FullName); } catch (Exception e) { logger?.LogException(Guid.Parse("{CE9439CA-5A1C-4ABC-9587-926F91B3AD22}"), e); return(null); } }
public static IShamanLogger Append(this IShamanLogger src, IShamanLogger another) { if (src.IsNullOrEmpty()) { return(another ?? EmptyShamanLogger.Instance); } if (another.IsNullOrEmpty()) { return(src ?? EmptyShamanLogger.Instance); } return(new MethodCallLogger(info => { src.Log(info); another.Log(info); }, (locationId, exception) => { src.LogException(locationId, exception); another.LogException(locationId, exception); })); }
private static EfModelWrapper GetModel(Type dbContextType, bool raw, IShamanLogger logger) { Action <string> log = message => logger.Log(typeof(ModelsCachedContainer), nameof(GetModelInternal), message); try { var instance = new ModelsCachedContainer { DbContextType = dbContextType, Raw = raw, Logger = logger }; return(instance.GetModelInternal()); } catch (Exception e) { logger.LogException(Guid.Parse("{F0BA1A53-86D9-430D-99A7-4D5792C593EF}"), e); log("Exception " + e.Message); throw; } }