public override Task Persistent() { var res = FreeSqlDb.Insert(this); res.ExecuteInserted(); return(Task.CompletedTask); }
public Startup(IConfiguration configuration) { Configuration = configuration; Fsql = FreeSqlDb.Builder(Configuration); Fsql.Aop.CurdAfter += (s, e) => { if (e.ElapsedMilliseconds > 1000) { //打印高耗时的sql Debug.WriteLine($"耗时:{e.ElapsedMilliseconds}ms,SQL:{e.Sql}"); } }; NLog.GlobalDiagnosticsContext.Set("DefaultConnection", Configuration.GetConnectionString("SqlConnection")); }
public void Configure(IWebHostBuilder builder) { builder.ConfigureServices((context, services) => { services.AddFreeSql(options => { var db = new FreeSqlDb() { Name = "FreeSqlDb", DataType = DataType.MySql, ConnectString = "Server=coobeedior.com;Database=log;User=root;Password=root;", IsAutoSyncStructure = true, IsNoneCommandParameter = false, IsLazyLoading = false, NameConvertType = NameConvertType.PascalCaseToUnderscoreWithLower, Executing = (command) => { }, Executed = (command, sql) => { } }; options.FreeSqlDbs.Add(db); }); }); }