Skip to content

Commit

Permalink
Add DateOnly and TimeOnly support for rev eng
Browse files Browse the repository at this point in the history
fixes #1642
  • Loading branch information
ErikEJ committed Jan 3, 2023
1 parent af4ba64 commit 0f2dac8
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 37 deletions.
18 changes: 16 additions & 2 deletions src/GUI/EFCorePowerTools.Shared/Models/ModelingOptionsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ public class ModelingOptionsModel : INotifyPropertyChanged
private bool useEf6Pluralizer;
private bool useBoolPropertiesWithoutDefaultSql;
private bool useNullableReferences;
private bool useNoConstructor;
private bool useNoDefaultConstructor;
private bool useNoNavigations;
private bool useNoObjectFilter;
private bool useManyToManyEntity;
private bool useDateOnlyTimeOnly;

public event PropertyChangedEventHandler PropertyChanged;

Expand Down Expand Up @@ -446,6 +445,21 @@ public bool UseManyToManyEntity
}
}

public bool UseDateOnlyTimeOnly
{
get => useDateOnlyTimeOnly;
set
{
if (value == useDateOnlyTimeOnly)
{
return;
}

useDateOnlyTimeOnly = value;
OnPropertyChanged();
}
}

[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,20 @@
Style="{StaticResource MarginCheckBlockStyle}"
TabIndex="21" />

<CheckBox Content="Map DateOnly and TimeOnly"
IsChecked="{Binding Model.UseDateOnlyTimeOnly}"
Style="{StaticResource MarginCheckBlockStyle}"
TabIndex="22" />

<CheckBox Content="{x:Static locale:ReverseEngineerLocale.MapNodaTimeTypes}"
IsChecked="{Binding Model.MapNodaTimeTypes}"
Style="{StaticResource MarginCheckBlockStyle}"
TabIndex="22" />
TabIndex="23" />

<CheckBox Content="{x:Static locale:ReverseEngineerLocale.UseEF6Pluralizer}"
IsChecked="{Binding Model.UseEf6Pluralizer}"
Style="{StaticResource MarginCheckBlockStyle}"
TabIndex="23" />
TabIndex="24" />

</StackPanel>
</GroupBox>
Expand All @@ -121,12 +126,12 @@
<dw:DialogButton Command="{Binding OkCommand}"
Content="{x:Static locale:SharedLocale.Ok}"
IsDefault="True"
TabIndex="20" />
TabIndex="40" />
<dw:DialogButton Command="{Binding CancelCommand}"
Content="{x:Static locale:SharedLocale.Cancel}"
IsCancel="True"
SnapsToDevicePixels="False"
TabIndex="21" />
TabIndex="41" />
</StackPanel>
</Grid>
</dw:DialogWindow>
9 changes: 5 additions & 4 deletions src/GUI/RevEng.Core.60/RevEng.Core.60.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
<PackageReference Include="EntityFrameworkCore.Scaffolding.Handlebars" Version="6.0.3" />
<PackageReference Include="EntityFrameworkCore.Sqlite.NodaTime" Version="6.0.0" />
<PackageReference Include="EntityFrameworkCore.SqlServer.HierarchyId" Version="3.0.1" />
<PackageReference Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" Version="6.0.0-preview.3" />
<PackageReference Include="FirebirdSql.EntityFrameworkCore.Firebird" Version="9.0.2" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="6.0.9" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.0-preview2.22314.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="6.0.12" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="6.0.7" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite" Version="6.0.7" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.61" />
Expand Down
3 changes: 2 additions & 1 deletion src/GUI/RevEng.Core.70/RevEng.Core.70.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<PackageReference Include="EntityFrameworkCore.Scaffolding.Handlebars" Version="7.0.0-beta1" />
<PackageReference Include="EntityFrameworkCore.Sqlite.NodaTime" Version="7.0.0" />
<PackageReference Include="EntityFrameworkCore.SqlServer.HierarchyId" Version="4.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.1" />
<PackageReference Include="ErikEJ.EntityFrameworkCore.SqlServer.DateOnlyTimeOnly" Version="7.0.0-preview.3" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.0-preview2.22314.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="7.0.1" />
Expand Down
13 changes: 13 additions & 0 deletions src/GUI/RevEng.Core/ServiceProviderBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using RevEng.Core.Procedures;
using System.Collections.Generic;
#if CORE60
using ErikEJ.EntityFrameworkCore.SqlServer.Design;
using SimplerSoftware.EntityFrameworkCore.SqlServer.NodaTime.Design;
#endif
using System;
Expand Down Expand Up @@ -159,6 +160,12 @@ public static ServiceProvider Build(ReverseEngineerCommandOptions options, List<
var nodaTime = new SqlServerNodaTimeDesignTimeServices();
nodaTime.ConfigureDesignTimeServices(serviceCollection);
}

if (options.UseDateOnlyTimeOnly)
{
var dateOnlyTimeOnly = new SqlServerDateOnlyTimeOnlyDesignTimeServices();
dateOnlyTimeOnly.ConfigureDesignTimeServices(serviceCollection);
}
#endif

break;
Expand Down Expand Up @@ -196,6 +203,12 @@ public static ServiceProvider Build(ReverseEngineerCommandOptions options, List<
var nodaTime = new SqlServerNodaTimeDesignTimeServices();
nodaTime.ConfigureDesignTimeServices(serviceCollection);
}

if (options.UseDateOnlyTimeOnly)
{
var dateOnlyTimeOnly = new SqlServerDateOnlyTimeOnlyDesignTimeServices();
dateOnlyTimeOnly.ConfigureDesignTimeServices(serviceCollection);
}
#endif

break;
Expand Down
1 change: 1 addition & 0 deletions src/GUI/RevEng.Shared/ReverseEngineerCommandOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@ public class ReverseEngineerCommandOptions
public bool UseLegacyResultSetDiscovery { get; set; }
public bool UseAsyncCalls { get; set; }
public bool PreserveCasingWithRegex { get; set; }
public bool UseDateOnlyTimeOnly { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ private async Task<bool> GetModelOptionsAsync(ReverseEngineerOptions options, st
UseNoObjectFilter = options.UseNoObjectFilter,
UseNoDefaultConstructor = options.UseNoDefaultConstructor,
UseManyToManyEntity = options.UseManyToManyEntity,
UseDateOnlyTimeOnly = options.UseDateOnlyTimeOnly,
};

var modelDialog = package.GetView<IModelingOptionsDialog>()
Expand Down Expand Up @@ -562,6 +563,7 @@ private async Task<bool> GetModelOptionsAsync(ReverseEngineerOptions options, st
options.UseNoObjectFilter = modelingOptionsResult.Payload.UseNoObjectFilter;
options.UseNoDefaultConstructor = modelingOptionsResult.Payload.UseNoDefaultConstructor;
options.UseManyToManyEntity = modelingOptionsResult.Payload.UseManyToManyEntity;
options.UseDateOnlyTimeOnly = modelingOptionsResult.Payload.UseDateOnlyTimeOnly;

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ public class ReverseEngineerOptions
[IgnoreDataMember]
public bool InstallNuGetPackage { get; set; }
public bool PreserveCasingWithRegex { get; set; } = true;
public bool UseDateOnlyTimeOnly { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void IAdvancedModelingOptionsViewModel.ApplyPresets(ModelingOptionsModel presets
Model.UseNullableReferences = presets.UseNullableReferences;
Model.UseSchemaFolders = presets.UseSchemaFolders;
Model.UseManyToManyEntity = presets.UseManyToManyEntity;
Model.UseDateOnlyTimeOnly= presets.UseDateOnlyTimeOnly;
}

private void Ok_Executed()
Expand Down
2 changes: 2 additions & 0 deletions src/GUI/Shared/ViewModels/ModelingOptionsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ void IModelingOptionsViewModel.ApplyPresets(ModelingOptionsModel presets)
Model.UseNullableReferences = presets.UseNullableReferences;
Model.UseNoObjectFilter = presets.UseNoObjectFilter;
Model.UseManyToManyEntity = presets.UseManyToManyEntity;
Model.UseDateOnlyTimeOnly = presets.UseDateOnlyTimeOnly;

Title = string.Format(ReverseEngineerLocale.GenerateEFCoreModelInProject, Model.ProjectName);
}
Expand Down Expand Up @@ -195,6 +196,7 @@ private void Advanced_Executed()
Model.UseNoObjectFilter = advancedModelingOptionsResult.Payload.UseNoObjectFilter;
Model.UseSchemaFolders = advancedModelingOptionsResult.Payload.UseSchemaFolders;
Model.UseManyToManyEntity = advancedModelingOptionsResult.Payload.UseManyToManyEntity;
Model.UseDateOnlyTimeOnly = advancedModelingOptionsResult.Payload.UseDateOnlyTimeOnly;
}
}
}
26 changes: 0 additions & 26 deletions src/GUI/efreveng60/BuildCmdlineTool.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,27 @@ dotnet publish -o bin\Release\net6.0\publish -f net6.0 -r win-x64 -c Release --n

if %errorlevel% equ 1 goto notbuilt

del bin\Release\net6.0\publish\Azure.Core.dll
del bin\Release\net6.0\publish\Azure.Identity.dll
del bin\Release\net6.0\publish\Ben.Demystifier.dll
del bin\Release\net6.0\publish\Bricelam.EntityFrameworkCore.Pluralizer.dll
del bin\Release\net6.0\publish\DacFxStrongTypedCore.dll
del bin\Release\net6.0\publish\DacFxStrongTypedCore.pdb
del bin\Release\net6.0\publish\Humanizer.dll
del bin\Release\net6.0\publish\Microsoft.Build.dll
del bin\Release\net6.0\publish\Microsoft.Build.Framework.dll
del bin\Release\net6.0\publish\Microsoft.Build.Utilities.Core.dll
del bin\Release\net6.0\publish\Microsoft.Data.SqlClient.dll
del bin\Release\net6.0\publish\Microsoft.Data.SqlClient.SNI.dll
del bin\Release\net6.0\publish\Microsoft.Data.SqlClient.SNI.pdb
del bin\Release\net6.0\publish\Microsoft.Data.Tools.Schema.Tasks.Sql.dll
del bin\Release\net6.0\publish\Microsoft.Data.Tools.Schema.Sql.dll
del bin\Release\net6.0\publish\Microsoft.Data.Tools.Sql.DesignServices.dll
del bin\Release\net6.0\publish\Microsoft.Data.Tools.Utilities.dll
del bin\Release\net6.0\publish\Microsoft.Identity.Client.dll
del bin\Release\net6.0\publish\Microsoft.Identity.Client.Extensions.Msal.dll
del bin\Release\net6.0\publish\Microsoft.IdentityModel.JsonWebTokens.dll
del bin\Release\net6.0\publish\Microsoft.IdentityModel.Logging.dll
del bin\Release\net6.0\publish\Microsoft.IdentityModel.Protocols.dll
del bin\Release\net6.0\publish\Microsoft.IdentityModel.Protocols.OpenIdConnect.dll
del bin\Release\net6.0\publish\Microsoft.IdentityModel.Tokens.dll
del bin\Release\net6.0\publish\Microsoft.SqlServer.Dac.dll
del bin\Release\net6.0\publish\Microsoft.SqlServer.Dac.Extensions.dll
del bin\Release\net6.0\publish\Microsoft.SqlServer.TransactSql.ScriptDom.dll
del bin\Release\net6.0\publish\Microsoft.SqlServer.Types.dll
del bin\Release\net6.0\publish\Microsoft.Win32.SystemEvents.dll
del bin\Release\net6.0\publish\NetTopologySuite.dll
del bin\Release\net6.0\publish\NetTopologySuite.IO.SqlServerBytes.dll
del bin\Release\net6.0\publish\System.CodeDom.dll
del bin\Release\net6.0\publish\System.Configuration.ConfigurationManager.dll
del bin\Release\net6.0\publish\System.Drawing.Common.dll
del bin\Release\net6.0\publish\System.IdentityModel.Tokens.Jwt.dll
del bin\Release\net6.0\publish\System.IO.Packaging.dll
del bin\Release\net6.0\publish\System.Memory.Data.dll
del bin\Release\net6.0\publish\System.Resources.Extensions.dll
del bin\Release\net6.0\publish\System.Runtime.Caching.dll
del bin\Release\net6.0\publish\System.Security.Cryptography.ProtectedData.dll
del bin\Release\net6.0\publish\System.Security.Permissions.dll
del bin\Release\net6.0\publish\System.Windows.Extensions.dll

del bin\Release\net6.0\publish\sni.dll
del bin\Release\net6.0\publish\System.Data.SqlClient.dll


"C:\Program Files\7-Zip\7z.exe" -mm=Deflate -mfb=258 -mpass=15 a efreveng60.exe.zip .\bin\Release\net6.0\publish\*

move /Y efreveng60.exe.zip ..\lib\
Expand Down
Binary file modified src/GUI/lib/efreveng60.exe.zip
Binary file not shown.
Binary file modified src/GUI/lib/efreveng70.exe.zip
Binary file not shown.

0 comments on commit 0f2dac8

Please sign in to comment.