Releases: dotnetcore/SmartSql
Releases · dotnetcore/SmartSql
v4.1.0
v4.0.88
- add support PropertyChanged for IsProperty-Tag
- update SmartSqlMapConfig.EnablePropertyChangedTrack default=false
- fix ResolveConfigPath with Env bug
- add support OrderBy Tag -> ref #56
- optimize deps-version
- add PropertyTokenizer
- add support nest object access by IGetAccessorFactory
- add support nest object access -> ref #51
[Fact]
public void QueryNestObject1()
{
var result = SqlMapper.ExecuteScalar<int>(new RequestContext
{
RealSql = "SELECT @User.Id",
Request = new {User = new {Id = 1}}
});
Assert.Equal(1, result);
}
[Fact]
public void QueryNestObject2()
{
var result = SqlMapper.ExecuteScalar<int>(new RequestContext
{
RealSql = "SELECT @User.Info.Id",
Request = new
{
User = new
{
Info = new
{
Id = 1
}
}
}
});
Assert.Equal(1, result);
}
[Fact]
public void QueryNestArray()
{
var result = SqlMapper.ExecuteScalar<int>(new RequestContext
{
RealSql = "SELECT @Order.Items[0]",
Request = new
{
Order = new
{
Items = new int[] {1}
}
}
});
Assert.Equal(1, result);
}
[Fact]
public void QueryNestList()
{
var result = SqlMapper.ExecuteScalar<int>(new RequestContext
{
RealSql = "SELECT @Order.Items[0]",
Request = new
{
Order = new
{
Items = new List<int>
{
1
}
}
}
});
Assert.Equal(1, result);
}
<?xml version="1.0" encoding="utf-8" ?>
<SmartSqlMap Scope="NestTest" xmlns="http://SmartSql.net/schemas/SmartSqlMap.xsd">
<Statements>
<Statement Id="QueryNestObject2">
SELECT @User.Info.Id
</Statement>
<Statement Id="QueryNestArray">
SELECT @Order.Items[0]
</Statement>
<Statement Id="QueryNestDic">
SELECT @Order.Items[Id]
</Statement>
<Statement Id="QueryNestArrayObject">
SELECT @Order.Items[0].Name
</Statement>
<Statement Id="FilterNestObject1">
<IsEqual Property="User.Id" CompareValue="1">
SELECT @User.Id
</IsEqual>
</Statement>
<Statement Id="FilterNestObject2">
<IsEqual Property="User.Info.Id" CompareValue="1">
SELECT @User.Info.Id
</IsEqual>
</Statement>
<Statement Id="FilterNestArray">
<IsEqual Property="Order.Items[0]" CompareValue="1">
SELECT @Order.Items[0]
</IsEqual>
</Statement>
<Statement Id="FilterNestDic">
<IsEqual Property="Order.Items[Id]" CompareValue="1">
SELECT @Order.Items[Id]
</IsEqual>
</Statement>
<Statement Id="FilterNestArrayObject">
<IsEqual Property="Order.Items[0].Name" CompareValue="SmartSql">
SELECT @Order.Items[0].Name
</IsEqual>
</Statement>
</Statements>
</SmartSqlMap>
v4.0.78
- add support EnablePropertyChangedTrack .ref #49
var entity = SqlMapper.GetById<AllPrimitive, long>(id0, true);
entity.String = "Updated";
SqlMapper.Update(entity);
-> only update Changed Property
Update T_AllPrimitive Set [String]=@String Where [Id]=@Id
or use IRepository
var entity=Repository.GetById(id);
entity.Name="Updated";
Repository.Update(entity)
v4.0.76
- refactor FormatSql
- refactor Middleware
- add support IFilter
SmartSqlBuilder = new SmartSqlBuilder()
.UseXmlConfig()
.UseLoggerFactory(LoggerFactory)
.UseAlias(GLOBAL_SMART_SQL)
.AddFilter<TestPrepareStatementFilter>()
.Build();
public class TestPrepareStatementFilter : IPrepareStatementFilter, ISetupSmartSql
{
private ILogger<TestPrepareStatementFilter> _logger;
public void OnInvoking(ExecutionContext context)
{
_logger.LogDebug("TestPrepareStatementFilter.OnInvoking");
}
public void OnInvoked(ExecutionContext context)
{
_logger.LogDebug("TestPrepareStatementFilter.OnInvoked");
}
public Task OnInvokingAsync(ExecutionContext context)
{
_logger.LogDebug("TestPrepareStatementFilter.OnInvokingAsync");
return Task.CompletedTask;
}
public Task OnInvokedAsync(ExecutionContext context)
{
_logger.LogDebug("TestPrepareStatementFilter.OnInvokedAsync");
return Task.CompletedTask;
}
public void SetupSmartSql(SmartSqlBuilder smartSqlBuilder)
{
_logger = smartSqlBuilder.LoggerFactory.CreateLogger<TestPrepareStatementFilter>();
}
}
v4.0.73
v4.0.72
v4.0.65
v4.0.59
- add SmartSql.InvokeSync proj
- add SmartSql.InvokeSync.Kafka proj
- add SmartSql.InvokeSync.RabbitMQ proj
- add ISyncFilter for InvokeSync
- add ISubscriber for InvokeSync
- add ValidateParameterMiddleware
- add ValidateResultMiddleware
- fix Statement DataSourceChoice bug
- add support ConcatString Property Expr for Properties
- fix #69
- add UseCacheManager for SmartSqlBuilder
- refactor CacheManager
- fix #70
- fix #71
v4.0.48
v4.0.42
- add support SmartSql.Bulk.MySqlConnector
- add support AOPTransaction to DyRepository interface [Not recommended]
- add some Geometric/Network Address/Arrays Types for PostgreSql TypeHandler
- add UnknownTypeHandler
- fix missing exception stack problem.
- fix Postgresql JsonTypeHandler bug
- add support CustomDeserializer.
- add support CommandTimeout
<Statement Id="Query" CommandTimeout="3">
SELECT
<IsNotEmpty Prepend="Top" Property="Taken">
(@Taken)
</IsNotEmpty>
T.* From T_User T
<Include RefId="QueryParams" />
<Switch Prepend="Order By" Property="OrderBy">
<Default>
T.Id Desc
</Default>
</Switch>
</Statement>
or
RequestContext.CommandTimeout=3
- add support return DictionaryStringObject