-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多个IFreesql中进行区别的Aop配置在查询时出现的表名异常 #1542
Comments
目前确实是这样,同一个DataType存储的实体类的映射内容是同一份,不是与IFreeSql关联。 |
好的👌🏻,谢啦~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述及重现代码:
针对dev/test/prod三个不同的环境,创建了对应的freesql实例存在缓存中,后续查询时会找到指定环境的freesql实例进行查询,
针对不同的实例,创建时通过AOP修改了对应表名,以达到针对不同的env使用指定schema下table的目的;
实际执行查询时发现生成的查询语句始终使用的是最后一次创建的freesql中aop所设置的表名; 如:
创建dev环境的freesql实例后,查询语句为:
SELECT a."id" FROM "DEV"."tableA" a ;
创建test环境的freesql实例后,查询语句为:
SELECT a."id" FROM "TEST"."tableA" a;
但这之后,哪怕是使用 GetInstance("DEV")获取到dev环境对应freesql,查询得到的语句仍然是:
SELECT a."id" FROM "TEST"."tableA" a;
以下为查询时的语句:
过程中监控了每次查询时使用的freesql,freesql.aop,freesql.ado.connectionstring,这些对象确实是对应环境的实例信息,但是生成的sql查询语句中的表名只适用了最后一次创建的freesql中的aop配置;
以下为freesql实例创建,AOP配置及缓存相关逻辑
数据库版本
PostgresSQL: 14.0
安装的Nuget包
PackageReference Include="FreeSql" Version="3.2.693"
PackageReference Include="FreeSql.DbContext" Version="3.2.693"
PackageReference Include="FreeSql.Provider.MySqlConnector" Version="3.2.693"
PackageReference Include="FreeSql.Provider.Oracle" Version="3.2.693"
PackageReference Include="FreeSql.Provider.PostgreSQL" Version="3.2.693"
PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.693"
PackageReference Include="FreeSql.Provider.SqlServer" Version="3.2.693"
PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.0"
PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" Version="4.0.0"
.net framework/. net core? 及具体版本
net6.0
The text was updated successfully, but these errors were encountered: