static void Main(string[] args) { IocContainerContext.Create().UserAutofac().UseDapper().BuildContainer(); string connectString = "Data Source=101.200.33.140;Initial Catalog=bslm;Persist Security Info=True;User ID=bslm;Password=bslm123!@#;MultipleActiveResultSets=True;Integrated Security=false"; IDbConnection connection = new SqlConnection(connectString); DynamicParameters dp = new DynamicParameters(); dp.Add("masterType", "LV_SysMenus", DbType.String); //var items = SqlDapperExtensions.QuereyProcedure<LabelValue>(connection, dp, "usp_lv"); dapper = IocContainerInvoker.Resolve <IDapper>(); int count = dapper.GetCount(connection, null, "Sys_User"); Console.WriteLine(count.ToString()); Console.ReadKey(); //foreach (var i in items) //{ // Console.WriteLine(i.ToString()); //} }
public IocContainerContext RegisterUnhandledExceptionHandler() { AppDomain.CurrentDomain.UnhandledException += (sender, e) => { var logger = IocContainerInvoker.Resolve <ILoggerFactory>().Create(GetType().FullName); logger.ErrorFormat("Unhandled exception: {0}", e.ExceptionObject); }; return(this); }
static void Main(string[] args) { IocContainerContext .Create() .UserAutofac() .UseLog4Net() .UseRepository() .UseDapper() .BuildContainer(); _logger = IocContainerInvoker.Resolve <ILoggerFactory>().Create(typeof(Program).Name); _logger.Debug("This is a Debug message."); }