Skip to content

Commit

Permalink
Release/0.8.4 (#278)
Browse files Browse the repository at this point in the history
* Resolved issue #274 (#275).  Code generation type model factory was a "first wins" for a clr type override, returning the same type model regardless of the number of times and nullable status of the code generator encountered in the model.

* Resolved issue # 273 (#276)

* Added overload to EnsureOpenAsync that doesn't require a cancellation token

* Moved code gen sections around to reduce the IDE warning 'Name can be simplified.' (#277)
  • Loading branch information
gwgrubbs committed Oct 6, 2021
1 parent 5eb2986 commit 0bcd3d5
Show file tree
Hide file tree
Showing 25 changed files with 1,352 additions and 1,330 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<Project>
<PropertyGroup>
<VersionPrefix>0.8.3</VersionPrefix>
<VersionPrefix>0.8.4</VersionPrefix>
<PackageIcon>images/htl-nuget-logo.png</PackageIcon>
<PackageReleaseNotes>See release notes at https://github.com/HatTrickLabs/dbExpression/releases/tag/v0.8.3</PackageReleaseNotes>
<PackageReleaseNotes>See release notes at https://github.com/HatTrickLabs/dbExpression/releases/tag/v0.8.4</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<None Include="../../build/htl-nuget-logo.png" Pack="true" Visible="false" PackagePath="images/htl-nuget-logo.png" />
Expand Down
13 changes: 12 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [0.8.4] - 2021-10-06

### Added

### Changed

### Fixed
- issue #274: Scaffolding produces wrong CLR type when providing a configuration (A TOOLS UPDATE IS REQUIRED)
- issue #273: Sql connector's EnsureOpenAsync should not require a cancellation token

### Breaking Changes

## [0.8.3] - 2021-09-09

### Added
Expand All @@ -15,7 +27,6 @@
- Selecting aliased fields requires the use of the generic version of dbex.Alias method
- SQL Statement executor factory no longer accepts the QueryExpression as a parameter for creating an executor


## [0.8.2] - 2021-09-02

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ public abstract partial class SimpleConsoleDbRuntimeSqlDatabase : IRuntimeSqlDat
IEnumerable<SchemaExpression> IExpressionListProvider<SchemaExpression>.Expressions => schemas;
#endregion

#region methods
void IRuntimeSqlDatabase.UseConfigurationFactory(IRuntimeSqlDatabaseConfigurationFactory configurationFactory)
=> SimpleConsoleDbRuntimeSqlDatabase.configurationFactory = configurationFactory ?? throw new ArgumentNullException(nameof(configurationFactory));
#endregion
}
#endregion

#region db
public partial class db : SimpleConsoleDbRuntimeSqlDatabase
{
#region constructors
static SimpleConsoleDbRuntimeSqlDatabase()
static db()
{
var dboSchema = new _dboDataService.dboSchemaExpression("dbo");
schemas.Add(dboSchema);
Expand All @@ -48,9 +58,6 @@ static SimpleConsoleDbRuntimeSqlDatabase()
#endregion

#region methods
void IRuntimeSqlDatabase.UseConfigurationFactory(IRuntimeSqlDatabaseConfigurationFactory configurationFactory)
=> SimpleConsoleDbRuntimeSqlDatabase.configurationFactory = configurationFactory ?? throw new ArgumentNullException(nameof(configurationFactory));

#region select one
/// <summary>
/// Start constructing a sql SELECT query expression for a single entity.
Expand Down Expand Up @@ -1400,7 +1407,6 @@ public partial class sec

}
#endregion

}
#endregion

Expand All @@ -1412,12 +1418,6 @@ public SimpleConsoleDb() : base(new db(), new SqlDatabaseMetadataProvider(new Si
}
#endregion

#region db
public partial class db : SimpleConsoleDbRuntimeSqlDatabase
{

}
#endregion
}

namespace SimpleConsole.dboDataService
Expand Down
2 changes: 1 addition & 1 deletion samples/mssql/NetCoreConsoleApp/NetCoreConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ public abstract partial class CRMDatabaseRuntimeSqlDatabase : IRuntimeSqlDatabas
IEnumerable<SchemaExpression> IExpressionListProvider<SchemaExpression>.Expressions => schemas;
#endregion

#region methods
void IRuntimeSqlDatabase.UseConfigurationFactory(IRuntimeSqlDatabaseConfigurationFactory configurationFactory)
=> CRMDatabaseRuntimeSqlDatabase.configurationFactory = configurationFactory ?? throw new ArgumentNullException(nameof(configurationFactory));
#endregion
}
#endregion

#region db
public partial class db : CRMDatabaseRuntimeSqlDatabase
{
#region constructors
static CRMDatabaseRuntimeSqlDatabase()
static db()
{
var dboSchema = new _dboDataService.dboSchemaExpression("dbo");
schemas.Add(dboSchema);
Expand All @@ -48,9 +58,6 @@ static CRMDatabaseRuntimeSqlDatabase()
#endregion

#region methods
void IRuntimeSqlDatabase.UseConfigurationFactory(IRuntimeSqlDatabaseConfigurationFactory configurationFactory)
=> CRMDatabaseRuntimeSqlDatabase.configurationFactory = configurationFactory ?? throw new ArgumentNullException(nameof(configurationFactory));

#region select one
/// <summary>
/// Start constructing a sql SELECT query expression for a single entity.
Expand Down Expand Up @@ -1400,7 +1407,6 @@ public partial class sec

}
#endregion

}
#endregion

Expand All @@ -1412,12 +1418,6 @@ public CRMDatabase() : base(new db(), new SqlDatabaseMetadataProvider(new CRMDat
}
#endregion

#region db
public partial class db : CRMDatabaseRuntimeSqlDatabase
{

}
#endregion
}

namespace ServerSideBlazorApp.dboDataService
Expand Down
10 changes: 5 additions & 5 deletions samples/mssql/ServerSideBlazorApp/Pages/Index.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
}
catch (Exception)
{
NavigationManager.NavigateTo($"/startup", true);
NavigationManager.NavigateTo("/startup", true);
}
}
}
Expand All @@ -48,7 +48,7 @@ private async Task<IEnumerable<SingleMetricDatasetModel>> GetDailySales()
}
catch (Exception)
{
NavigationManager.NavigateTo($"/startup", true);
NavigationManager.NavigateTo("/startup", true);
}
return null;
}
Expand All @@ -60,8 +60,8 @@ private async Task<IEnumerable<SingleMetricDatasetModel>> GetSalesByProductCateg
var sales = await OrderService.GetSalesByProductCategory();

if (!sales.Any())
throw new ApplicationException();
NavigationManager.NavigateTo("/startup", true);

return sales.Select(x =>
new SingleMetricDatasetModel<double>
{
Expand All @@ -72,7 +72,7 @@ private async Task<IEnumerable<SingleMetricDatasetModel>> GetSalesByProductCateg
}
catch (Exception)
{
NavigationManager.NavigateTo($"/startup", true);
NavigationManager.NavigateTo("/startup", true);
}
return null;
}
Expand Down
1 change: 1 addition & 0 deletions samples/mssql/ServerSideBlazorApp/Pages/Startup.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/startup"
@inject NavigationManager NavigationManager
<Heading Size="HeadingSize.Is3">Uh-Oh!</Heading>

<Paragraph>It doesn't look like your environment is configured to run the sample application for dbExpression. Please complete the following checklist before perusing around the application:</Paragraph>
Expand Down
7 changes: 4 additions & 3 deletions samples/mssql/ServerSideBlazorApp/Pages/Startup.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ private async Task Refresh()

successStep = 3;

if (!await EvaluateHasAnImage())
return;
if (await EvaluateHasAnImage())
successStep = 4;

successStep = 4;
if (successStep >= 3)
NavigationManager.NavigateTo("/");
}

private string GetFontAwesome(int step)
Expand Down
12 changes: 6 additions & 6 deletions samples/mssql/ServerSideBlazorApp/ServerSideBlazorApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blazorise.Charts" Version="0.9.3.9" />
<PackageReference Include="Blazorise.Components" Version="0.9.3.9" />
<PackageReference Include="Blazorise.DataGrid" Version="0.9.3.9" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.3.9" />
<PackageReference Include="Blazorise.Icons.Material" Version="0.9.3.9" />
<PackageReference Include="Blazorise.Material" Version="0.9.3.9" />
<PackageReference Include="Blazorise.Charts" Version="0.9.4.6" />
<PackageReference Include="Blazorise.Components" Version="0.9.4.6" />
<PackageReference Include="Blazorise.DataGrid" Version="0.9.4.6" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.4.6" />
<PackageReference Include="Blazorise.Icons.Material" Version="0.9.4.6" />
<PackageReference Include="Blazorise.Material" Version="0.9.4.6" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/HatTrick.DbEx.MsSql/HatTrick.DbEx.MsSql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<ProjectReference Include="..\HatTrick.DbEx.Sql\HatTrick.DbEx.Sql.csproj" />
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/HatTrick.DbEx.Sql/Connection/SqlConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public void EnsureOpen()
_dbConnection.Open();
}

public async Task EnsureOpenAsync()
{
await EnsureOpenAsync(default);
}

public async Task EnsureOpenAsync(CancellationToken ct)
{
ct.ThrowIfCancellationRequested();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
10 changes: 6 additions & 4 deletions test/HatTrick.DbEx.MsSql.Test.Database/Executor/Mapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void Can_map_nullable_enum_to_non_null_value_for_dynamic_object(int versi
.Execute();

//then
((ProductCategoryType?)product.ProductCategoryType).Should().BeAssignableTo<ProductCategoryType>();
((ProductCategoryType?)product.ProductCategoryType).Should().NotBeNull();
}

[Theory]
Expand Down Expand Up @@ -90,10 +90,11 @@ public void Can_map_enum_to_value_for_dynamic_object(int version)
dbo.Person.GenderType
)
.From(dbo.Person)
.Where(dbo.Person.Id == 1)
.Execute();

//then
((GenderType)person.GenderType).Should().BeAssignableTo<GenderType>();
((GenderType)person.GenderType).Should().Be(GenderType.Male);
}

[Theory]
Expand Down Expand Up @@ -177,7 +178,7 @@ public void Can_map_nullable_enum_to_non_null_value_for_dynamic_object_when_prov
});

//then
((ProductCategoryType?)product.ProductCategoryType).Should().BeAssignableTo<ProductCategoryType>();
((ProductCategoryType?)product.ProductCategoryType).Should().NotBeNull();
}

[Theory]
Expand Down Expand Up @@ -218,6 +219,7 @@ public void Can_map_enum_to_value_for_dynamic_object_when_providing_mapping_func
dbo.Person.GenderType
)
.From(dbo.Person)
.Where(dbo.Person.Id == 1)
.Execute(p => {
dynamic d = new ExpandoObject();
d.Id = p.ReadField().GetValue<int>();
Expand All @@ -226,7 +228,7 @@ public void Can_map_enum_to_value_for_dynamic_object_when_providing_mapping_func
});

//then
((GenderType)person.GenderType).Should().BeAssignableTo<GenderType>();
((GenderType)person.GenderType).Should().Be(GenderType.Male);
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void Does_an_empty_update_expression_set_cause_sql_exception(int version,
.ExecuteAsync();

//when & then
execute.Should().Throw<SqlException>().And.Message.Should().StartWith("Incorrect syntax near");
execute.Should().ThrowAsync<SqlException>().Result.And.Message.Should().StartWith("Incorrect syntax near");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="161.46367.54" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="161.46437.65" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 0bcd3d5

Please sign in to comment.