Skip to content

Releases: dotnetcore/SmartSql

v4.1.0

24 Jul 15:25
Compare
Choose a tag to compare
Update issue templates

v4.0.88

24 Jul 05:46
Compare
Choose a tag to compare
  1. add support PropertyChanged for IsProperty-Tag
  2. update SmartSqlMapConfig.EnablePropertyChangedTrack default=false
  3. fix ResolveConfigPath with Env bug
  4. add support OrderBy Tag -> ref #56
  5. optimize deps-version
  6. add PropertyTokenizer
  7. add support nest object access by IGetAccessorFactory
  8. 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

19 Jul 08:13
Compare
Choose a tag to compare
  1. 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

17 Jul 14:17
Compare
Choose a tag to compare
  1. refactor FormatSql
  2. refactor Middleware
  3. 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

10 Jul 03:59
Compare
Choose a tag to compare
  1. fix #77

v4.0.72

05 Jul 15:36
Compare
Choose a tag to compare
  1. refactor SnowflakeId support ToIdString -> {yyyyMMddHHmmssfff}{machineId}{sequenceId}
  2. refactor sync proj
  3. add Kafka Sync Imlp
  4. refactor Cahce
  5. add support #57 ( Using MQ to handle the final consistency of memory-level caches in Service Clusters )

v4.0.65

17 Jun 04:09
Compare
Choose a tag to compare
  1. change BeginTransaction return DbTransaction
  2. fix #72
  3. add IRepositoryProxy to DyRepositoryImpl
  4. add IsNotProperty Tag

v4.0.59

11 Jun 09:55
Compare
Choose a tag to compare
  1. add SmartSql.InvokeSync proj
  2. add SmartSql.InvokeSync.Kafka proj
  3. add SmartSql.InvokeSync.RabbitMQ proj
  4. add ISyncFilter for InvokeSync
  5. add ISubscriber for InvokeSync
  6. add ValidateParameterMiddleware
  7. add ValidateResultMiddleware
  8. fix Statement DataSourceChoice bug
  9. add support ConcatString Property Expr for Properties
  10. fix #69
  11. add UseCacheManager for SmartSqlBuilder
  12. refactor CacheManager
  13. fix #70
  14. fix #71

v4.0.48

24 May 15:06
Compare
Choose a tag to compare
  1. add CustomSnowflakeId
  2. add support MultipleResultMap for ValueTupleDeserializer
  3. add support Colon Key for Properties
  4. add InvokeSucceedListener (support approximate-real-time synchronization to other storage(e.g. ElasticSearch))

v4.0.42

28 Apr 13:10
Compare
Choose a tag to compare
  1. add support SmartSql.Bulk.MySqlConnector
  2. add support AOPTransaction to DyRepository interface [Not recommended]
  3. add some Geometric/Network Address/Arrays Types for PostgreSql TypeHandler
  4. add UnknownTypeHandler
  5. fix missing exception stack problem.
  6. fix Postgresql JsonTypeHandler bug
  7. add support CustomDeserializer.
  8. 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
  1. add support return DictionaryStringObject