dotnetcore / SmartSql

SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
https://smartsql.net/
Apache License 2.0
1.1k stars 222 forks source link

Redis配置 #52

Closed liyuan0420 closed 5 years ago

liyuan0420 commented 5 years ago

1.提取到Config统一配置Connection; 2.可加入环境变量配置

Ahoo-Wang commented 5 years ago

SmartSql-V4 已支持注入外部配置,见以下demo

services
                .AddSmartSql((builder) =>
                {
                    builder.UseProperties(Configuration);
                })
                .AddRepositoryFromAssembly(o =>
                {
                    o.AssemblyString = "SmartSql.Sample.AspNetCore";
                    o.Filter = (type) =>
                    {
                        return type.Namespace == "SmartSql.Sample.AspNetCore.DyRepositories";
                    };
                });

https://github.com/Smart-Kit/SmartSql/blob/master/sample/SmartSql.Sample.AspNetCore/Startup.cs#L26