public async Task GetComplexType(ComplexTypeModel model) { await Task.CompletedTask; var query = HttpContext.Request.QueryString.HasValue ? HttpContext.Request.QueryString.Value : string.Empty; _logger.LogWarning(JsonConvert.SerializeObject(model)); }
public void SqlBulkTools_UpdateQuery_WhenTypeIsComplex() { BulkOperations bulk = new BulkOperations(); var model = new ComplexTypeModel { AverageEstimate = new EstimatedStats { TotalCost = 234.3 }, MinEstimate = new EstimatedStats { TotalCost = 3434.33 }, Competition = 30, SearchVolume = 234.34 }; int result; using (TransactionScope trans = new TransactionScope()) { using (SqlConnection conn = new SqlConnection(ConfigurationManager .ConnectionStrings["SqlBulkToolsTest"].ConnectionString)) { bulk.Setup <ComplexTypeModel>() .ForDeleteQuery() .WithTable("ComplexTypeTest") .Delete() .AllRecords() .Commit(conn); bulk.Setup <ComplexTypeModel>() .ForObject(model) .WithTable("ComplexTypeTest") .AddAllColumns() .Insert() .SetIdentityColumn(x => x.Id) .Commit(conn); result = bulk.Setup <ComplexTypeModel>() .ForObject(model) .WithTable("ComplexTypeTest") .AddAllColumns() .Update() .Where(x => x.MinEstimate.TotalCost > 3000) .SetIdentityColumn(x => x.Id) .Commit(conn); } trans.Complete(); } Assert.IsTrue(result == 1); }
public void SqlBulkTools_UpsertQuery_WhenTypeIsComplex() { BulkOperations bulk = new BulkOperations(); var model = new ComplexTypeModel { AverageEstimate = new EstimatedStats { TotalCost = 234.3 }, MinEstimate = new EstimatedStats { TotalCost = 3434.33 }, Competition = 30, SearchVolume = 234.34 }; using (TransactionScope trans = new TransactionScope()) { using (SqlConnection conn = new SqlConnection(_connectionString)) { bulk.Setup <ComplexTypeModel>() .ForDeleteQuery() .WithTable("ComplexTypeTest") .Delete() .AllRecords() .Commit(conn); bulk.Setup <ComplexTypeModel>() .ForObject(model) .WithTable("ComplexTypeTest") .AddAllColumns() .Upsert() .MatchTargetOn(x => x.Id) .SetIdentityColumn(x => x.Id) .Commit(conn); } trans.Complete(); } Assert.IsTrue(_dataAccess.GetComplexTypeModelCount() > 0); }
public async Task TaskComplexTypeModel([FromBody] ComplexTypeModel model) { await Task.CompletedTask; _logger.LogWarning(JsonConvert.SerializeObject(model)); }