예제 #1
0
 /// <summary>
 /// Log a message to the injected ILogFactory class that the application is using, if any is used
 /// </summary>
 /// <param name="message">The message to log</param>
 /// <param name="level">The level of severity of this log message</param>
 /// <param name="memberName">The name of the calling method. The default is the calling method's name.</param>
 /// <param name="filePath">The file path to the calling method. The default is the callers method file path</param>
 /// <param name="lineNumber">The line number in source code of the caller method. The default is the caller methods line number</param>
 public static void Log(string message, LogFactoryLevel level = LogFactoryLevel.Information,
                        [CallerMemberName] string memberName  = "",
                        [CallerFilePath] string filePath      = "",
                        [CallerLineNumber] int lineNumber     = 0)
 {
     IoCContainer.Get <ILogFactory>().Log(message, level, $"[{FileHelpers.GetFileFolderName(filePath)} line {lineNumber} {memberName}()]");
 }
예제 #2
0
 /// <summary>
 /// Attempts to get the injected service of the specified type
 /// </summary>
 /// <param name="type">The type of service to fetch</param>
 /// <returns></returns>
 public static object Get(Type type)
 {
     return(IoCContainer.Get(type));
 }
예제 #3
0
 /// <summary>
 /// Attempts to get the injected service of the specified type
 /// </summary>
 /// <typeparam name="T">The type of service to fetch</typeparam>
 /// <returns></returns>
 public static T Get <T>()
 {
     return(IoCContainer.Get <T>());
 }