Skip to content

Commit

Permalink
Support CLR types from .dacpac
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed Nov 27, 2023
1 parent 60040d5 commit cc2019a
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<PackageId>ErikEJ.EntityFrameworkCore.SqlServer.Dacpac</PackageId>
<PackageVersion>7.0.3</PackageVersion>
<PackageVersion>7.0.4</PackageVersion>
<NoWarn>$(NoWarn);EF1001</NoWarn>
<Authors>ErikEJ</Authors>
<Description>Enables reverse engineering an EF Core model from a data-tier application package (DACPAC).</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<PackageId>ErikEJ.EntityFrameworkCore.SqlServer.Dacpac</PackageId>
<PackageVersion>8.0.0</PackageVersion>
<PackageVersion>8.0.1</PackageVersion>
<NoWarn>$(NoWarn);EF1001</NoWarn>
<Authors>ErikEJ</Authors>
<Description>Enables reverse engineering an EF Core model from a data-tier application package (DACPAC).</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<PackageId>ErikEJ.EntityFrameworkCore.SqlServer.Dacpac</PackageId>
<PackageVersion>6.0.3</PackageVersion>
<PackageVersion>6.0.4</PackageVersion>
<NoWarn>$(NoWarn);EF1001</NoWarn>
<Authors>ErikEJ</Authors>
<Description>Enables reverse engineering an EF Core model from a data-tier application package (DACPAC).</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,17 +380,19 @@ private static IEnumerable<TSqlColumn> GetColumns(TSqlTable item, DatabaseTable
string storeType = null;
string systemTypeName = null;

if (col.DataType.First().Name.Parts.Count > 1)
if (col.DataType.First().Name.Parts.Count > 1 && typeAliases.TryGetValue($"{col.DataType.First().Name.Parts[0]}.{col.DataType.First().Name.Parts[1]}", out var value))
{
if (typeAliases.TryGetValue($"{col.DataType.First().Name.Parts[0]}.{col.DataType.First().Name.Parts[1]}", out var value))
{
storeType = value.StoreType;
systemTypeName = value.TypeName;
}
storeType = value.StoreType;
systemTypeName = value.TypeName;
}
else
{
var dataTypeName = col.DataType.First().Name.Parts[0];
if (col.DataType.First().Name.Parts.Count > 1)
{
dataTypeName = col.DataType.First().Name.Parts[1];
}

int maxLength = col.IsMax ? -1 : col.Length;
storeType = GetStoreType(dataTypeName, maxLength, col.Precision, col.Scale);
systemTypeName = dataTypeName;
Expand Down
1 change: 0 additions & 1 deletion src/GUI/RevEng.Core.60/ConnectionStringResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#if !CORE80
using FirebirdSql.Data.FirebirdClient;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
using MySqlConnector;
using Oracle.ManagedDataAccess.Client;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/GUI/efcpt.7/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static Task<int> DisplayHelpAsync(ParserResult<ScaffoldOptions> parserRe
{
h.AddPostOptionsLine("SAMPLES:");
h.AddPostOptionsLine(@" efcpt ""Data Source=.;Initial Catalog=Chinook;User=sa;Pwd=123""");
h.AddPostOptionsLine(@" efcpt ""/temp/mydb.dacpac"" Microsoft.EntityFrameworkCore.SqlServer");
h.AddPostOptionsLine(@" efcpt ""/temp/mydb.dacpac"" mssql");
h.AddPostOptionsLine(@" efcpt ""Server=my.database.windows.net;Authentication=Active Directory Default;Database=myddb;User [email protected];"" mssql");
return h;
}));
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.
Binary file modified src/GUI/lib/efreveng80.exe.zip
Binary file not shown.
1 change: 1 addition & 0 deletions test/ScaffoldingTester/Database/Database.sqlproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@
</ItemGroup>
<ItemGroup>
<Build Include="dbo\Tables\Table1.sql" />
<Build Include="dbo\Tables\Logger.sql" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions test/ScaffoldingTester/Database/dbo/Tables/Logger.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE [dbo].[Logger]
(
[Id] NVARCHAR(10) NOT NULL,
[CompanyId] NCHAR(2) NOT NULL,
[Location] GEOGRAPHY NULL,
[Parents] HierarchyId NULL,
[LocationChanged] DATETIMEOFFSET NULL,
[BatteryLevel] INT NULL,
[SignalStrength] INT NULL,
[MeasurementsChanged] DATETIMEOFFSET NULL,
[TestCol] [sys].[sysname] NULL,
CONSTRAINT [PK_Loggers] PRIMARY KEY CLUSTERED ([Id])
);

0 comments on commit cc2019a

Please sign in to comment.