Skip to content
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

Cud statement #197

Merged
merged 22 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
19bf3a4
fixed. 修复CUD模块中自动生成的SQL语句,在Oracle下提示ORA-00933命令未正确结束的错误。原因是SQL语句结束处,加…
gmij Mar 10, 2022
11a40b3
Merge branch 'dotnetcore:master' into master
gmij Apr 8, 2022
bf71f5b
fixed. 当使用CUD模块,没有xml配置项时,会导致缓存无法开启。移除对SqlMaps的缓存配置项检查。
gmij Apr 8, 2022
25ef2f6
移除注释的代码。
gmij Apr 8, 2022
73261f8
Merge branch 'dotnetcore:master' into master
gmij Apr 8, 2022
50628f3
Merge branch 'dotnetcore:master' into master
gmij Apr 8, 2022
36498c4
动态插入时,自动生成Statement配置信息。
gmij Apr 8, 2022
20e5b9c
Merge branch 'master' of https://github.com/gmij/SmartSql
gmij Apr 8, 2022
56b07bf
fixed. CUD,在执行时,把Statement加入到内存中,已能和缓存产生完整交互。
gmij Apr 8, 2022
f9615d3
1. 优化CUDStatement的默认名称的引用
gmij Apr 8, 2022
96da01f
优化Statement的使用。
gmij Apr 8, 2022
38b4c8d
add. CUD statement build
gmij Apr 11, 2022
5f611ef
commit unit test
gmij Apr 11, 2022
7d61e43
优化sql生成过程
gmij Apr 12, 2022
a19ec72
完善insert和update的语法构成方式。
gmij Apr 12, 2022
9c05d36
fix. insert and update CUD invalid.
gmij Apr 12, 2022
c0a4144
移除过期的代码。
gmij Apr 12, 2022
e1aebfe
add. DyRepository缓存加载
gmij Apr 13, 2022
155de18
合并变更
gmij Apr 13, 2022
433684b
合并,解决冲突
gmij Apr 13, 2022
c42a05e
fixed. CUD模块和动态仓储模块同时启用时,动态仓储上设置同名Statement时,缓存不生效。
gmij Apr 13, 2022
7d20dd7
merge commited.
gmij Apr 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/SmartSql.DyRepository/EmitRepositoryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ private Statement PreStatement(Type interfaceType, SqlMap sqlMap, MethodInfo met
throw new SmartSqlException($"Statement.FullSqlId:[{fullSqlId}] already exists!");
}

var resultCacheAttr = methodInfo.GetCustomAttribute<ResultCacheAttribute>();
statement = new Statement
{
SqlMap = sqlMap,
Expand All @@ -339,15 +338,18 @@ private Statement PreStatement(Type interfaceType, SqlMap sqlMap, MethodInfo met
statement.SourceChoice = statementAttr.SourceChoice;
}

if (resultCacheAttr != null)
{
statement.CacheId = ParseCacheFullId(sqlMap.Scope, resultCacheAttr.CacheId);
statement.Cache = sqlMap.GetCache(statement.CacheId);
}

sqlMap.Statements.Add(statement.FullSqlId, statement);

}

var resultCacheAttr = methodInfo.GetCustomAttribute<ResultCacheAttribute>();
if (resultCacheAttr != null)
{
statement.CacheId = ParseCacheFullId(sqlMap.Scope, resultCacheAttr.CacheId);
statement.Cache = sqlMap.GetCache(statement.CacheId);
}


returnType = isTaskReturnType ? returnType.GetGenericArguments().FirstOrDefault() : returnType;
if (returnType == typeof(DataTable))
{
Expand Down
6 changes: 6 additions & 0 deletions src/SmartSql/CUD/CUDSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
using SmartSql.Configuration;
using SmartSql.Configuration.Tags;
using SmartSql.DataSource;
using SmartSql.Reflection.TypeConstants;
using SmartSql.Utils;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace SmartSql.CUD
{
Expand Down Expand Up @@ -33,6 +37,8 @@ public CUDSqlGenerator(SmartSqlConfig config)
_analyzer = new StatementAnalyzer();
}



private Statement BuildStatement(string statementId, string sql, SqlMap sqlMap)
{
return new Statement()
Expand Down