Skip to content

Commit e3fecf2

Browse files
committed
VS support for new .NET in client project and Npgsql upgrade
Allow compiling .NET client with Nuget package. Use Revenj instead of legacy Npgsql to support SCRAM.
1 parent dd5d60b commit e3fecf2

12 files changed

+59
-32
lines changed

VisualStudioPlugin/2010/DSLPlatform.2010.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
2929
<OutputPath>bin\Release\</OutputPath>
30-
<DefineConstants>TRACE</DefineConstants>
30+
<DefineConstants>TRACE;VS2010</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>
3333
<RunCodeAnalysis>false</RunCodeAnalysis>
@@ -88,15 +88,15 @@
8888
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0">
8989
<HintPath>..\Dependencies\Microsoft.VisualStudio.Shell.Immutable.10.0.dll</HintPath>
9090
</Reference>
91-
<Reference Include="Mono.Security">
92-
<HintPath>..\Dependencies\Mono.Security.dll</HintPath>
93-
</Reference>
94-
<Reference Include="Npgsql">
95-
<HintPath>..\Dependencies\Npgsql.dll</HintPath>
96-
</Reference>
9791
<Reference Include="Oracle.ManagedDataAccess">
9892
<HintPath>..\Dependencies\Oracle.ManagedDataAccess.dll</HintPath>
9993
</Reference>
94+
<Reference Include="Revenj.Core">
95+
<HintPath>..\Dependencies\Revenj.Core.dll</HintPath>
96+
</Reference>
97+
<Reference Include="Revenj.Core.Interface">
98+
<HintPath>..\Dependencies\Revenj.Core.Interface.dll</HintPath>
99+
</Reference>
100100
<Reference Include="System" />
101101
<Reference Include="System.ComponentModel.Composition" />
102102
<Reference Include="System.Configuration" />

VisualStudioPlugin/2010/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Identifier Id="DDDLanguage..0c2dba72-d915-4d37-9379-2100b92042de">
44
<Name>DSL Platform</Name>
55
<Author>N.G.S.</Author>
6-
<Version>1.8.2</Version>
6+
<Version>2.0.0</Version>
77
<Description xml:space="preserve">Domain Specification Language by DSL Platform. Based on Domain-Driven Design</Description>
88
<Locale>1033</Locale>
99
<MoreInfoUrl>https://dsl-platform.com</MoreInfoUrl>

VisualStudioPlugin/ChunkedMemoryStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public override long Seek(long offset, SeekOrigin origin)
6060
CurrentPosition += (int)offset;
6161
break;
6262
default:
63-
CurrentPosition = TotalSize - (int)offset;
63+
CurrentPosition = TotalSize + (int)offset;
6464
break;
6565
}
6666
return CurrentPosition;

VisualStudioPlugin/DSLPlatform.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,17 @@
266266
<Reference Include="Microsoft.VisualStudio.Validation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
267267
<HintPath>packages\Microsoft.VisualStudio.Validation.15.0.82\lib\net45\Microsoft.VisualStudio.Validation.dll</HintPath>
268268
</Reference>
269-
<Reference Include="Mono.Security">
270-
<HintPath>..\..\..\..\..\..\Projects\dsl-compiler-client\VisualStudioPlugin\Dependencies\Mono.Security.dll</HintPath>
271-
</Reference>
272-
<Reference Include="Npgsql">
273-
<HintPath>..\..\..\..\..\..\Projects\dsl-compiler-client\VisualStudioPlugin\Dependencies\Npgsql.dll</HintPath>
274-
</Reference>
275269
<Reference Include="Oracle.ManagedDataAccess">
276270
<HintPath>..\..\..\..\..\..\Projects\dsl-compiler-client\VisualStudioPlugin\Dependencies\Oracle.ManagedDataAccess.dll</HintPath>
277271
</Reference>
278272
<Reference Include="PresentationCore" />
279273
<Reference Include="PresentationFramework" />
274+
<Reference Include="Revenj.Core">
275+
<HintPath>Dependencies\Revenj.Core.dll</HintPath>
276+
</Reference>
277+
<Reference Include="Revenj.Core.Interface">
278+
<HintPath>Dependencies\Revenj.Core.Interface.dll</HintPath>
279+
</Reference>
280280
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
281281
<EmbedInteropTypes>False</EmbedInteropTypes>
282282
</Reference>
61.5 KB
Binary file not shown.
1.44 MB
Binary file not shown.

VisualStudioPlugin/Gui/CompileTargets.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ internal class CompileTargets
1616
}
1717
private static List<LibraryInfo.Nuget> RevenjStandard()
1818
{
19-
return new List<LibraryInfo.Nuget>(new[] { new LibraryInfo.Nuget { Project = "revenj", Version = "1.5.1" } });
19+
return new List<LibraryInfo.Nuget>(new[] { new LibraryInfo.Nuget { Project = "revenj", Version = "1.6.1" } });
20+
}
21+
private static List<LibraryInfo.Nuget> RevenjClient()
22+
{
23+
return new List<LibraryInfo.Nuget>(new[] { new LibraryInfo.Nuget { Project = "revenj.client", Version = "0.9.0" } });
2024
}
2125

2226
private static readonly string[] PocoDependencies = new[] {
@@ -100,7 +104,7 @@ private static Version NoVersion(LibraryInfo library)
100104
false,
101105
PocoDependencies,
102106
NoDependencies(),
103-
BuildTypes.LegacyDotNet,
107+
BuildTypes.DotNetStandard,
104108
".cs",
105109
BuildTypes.LegacyDotNet, BuildTypes.DotNetStandard);
106110
public readonly LibraryInfo PocoLibrary = PocoLibraryDefault.Clone();
@@ -112,9 +116,10 @@ private static Version NoVersion(LibraryInfo library)
112116
NoVersion,
113117
true,
114118
PocoDependencies,
115-
NoDependencies(),
116-
BuildTypes.LegacyDotNet,
117-
".cs");
119+
RevenjClient(),
120+
BuildTypes.DotNetStandard,
121+
".cs",
122+
BuildTypes.LegacyDotNet, BuildTypes.DotNetStandard);
118123
public readonly LibraryInfo ClientLibrary = ClientLibraryDefault.Clone();
119124
private LibraryInfo oldPortableLibrary;
120125
public static readonly LibraryInfo PortableLibraryDefault =
@@ -282,7 +287,7 @@ public Either<List<string>> Compile(List<string> dsls)
282287
{
283288
if (!t.TargetExists)
284289
return Either<List<string>>.Fail("Could not find " + t.Type + " target folder: " + t.Target);
285-
if (t.RequireDependenciesLegacy && !t.DependenciesExists)
290+
if (t.RequireDependenciesLegacy && !t.DependenciesExists && t.BuildType == BuildTypes.LegacyDotNet)
286291
return Either<List<string>>.Fail("Could not find " + t.Type + " dependencies folder: " + t.Dependencies);
287292
var result = RunCompiler(CompilerPath, t, dsls);
288293
if (!result.Success)

VisualStudioPlugin/Gui/ServerActions.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
using System.Xml.Linq;
1010
using EnvDTE;
1111
using Ionic.Zip;
12-
using Npgsql;
1312
using Oracle.ManagedDataAccess.Client;
13+
using Revenj.DatabasePersistence.Postgres.Npgsql;
1414

1515
namespace DSLPlatform
1616
{
@@ -165,6 +165,9 @@ public static Either<bool> DownloadZip(string fromWhere, string zipName, string
165165
foreach (var ze in zf.Entries)
166166
{
167167
zipFiles.Add(ze.FileName);
168+
var filename = Path.Combine(path, ze.FileName);
169+
TryDelete(filename + ".tmp");
170+
TryDelete(filename + ".PendingOverwrite");
168171
ze.Extract(path, ExtractExistingFileAction.OverwriteSilently);
169172
}
170173
}
@@ -174,6 +177,17 @@ public static Either<bool> DownloadZip(string fromWhere, string zipName, string
174177
});
175178
}
176179

180+
private static void TryDelete(string file)
181+
{
182+
var fi = new FileInfo(file);
183+
if (!fi.Exists) return;
184+
try
185+
{
186+
fi.Delete();
187+
}
188+
catch { }
189+
}
190+
177191
private static Dictionary<string, string> GatherCurrentDsl(DTE dte)
178192
{
179193
var dsls = new Dictionary<string, string>();
@@ -554,15 +568,15 @@ private static DbInfo ReadInfoFromOracle(DatabaseInfo dbInfo)
554568

555569
private static DbInfo ReadInfoFromPostgres(DatabaseInfo dbInfo)
556570
{
557-
var postgresVersion = new Version(9, 3);
571+
var postgresVersion = new Version(11, 0);
558572
try
559573
{
560574
using (var conn = new NpgsqlConnection(dbInfo.ConnectionString))
561575
{
562576
var com = conn.CreateCommand();
563577
conn.Open();
564578
if (!Version.TryParse(conn.ServerVersion, out postgresVersion))
565-
postgresVersion = new Version(9, 3);
579+
postgresVersion = new Version(11, 0);
566580
IDataReader dr;
567581
try
568582
{
@@ -607,10 +621,10 @@ private static void ApplyPostgresMigration(Stream stream, bool force, DatabaseIn
607621
{
608622
if (!force)
609623
CheckForce(stream);
610-
using (var conn = new Npgsql.NpgsqlConnection(dbInfo.ConnectionString))
624+
using (var conn = new NpgsqlConnection(dbInfo.ConnectionString))
611625
{
612626
conn.Open();
613-
var com = new Npgsql.NpgsqlCommand(stream);
627+
var com = new NpgsqlCommand(stream);
614628
com.Connection = conn;
615629
com.ExecuteNonQuery();
616630
conn.Close();

VisualStudioPlugin/Gui/View/ConfigurationClientControl.xaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,21 @@ DSL Platform libraries are BSD licensed and source is available on GitHub.
4040
ToolTip="Target folder is used to place compiled library."
4141
Foreground="{Binding Path=ClientLibrary.TargetColor}"/>
4242
</DockPanel>
43-
<DockPanel Margin="5" Visibility="{Binding Path=ClientLibrary.LegacyVisibility}">
43+
<DockPanel Margin="5">
4444
<Button Content="Dependency path" Width="120"
4545
Command="{Binding ChangeDependencies}" CommandParameter="Client" />
4646
<TextBox Text="{Binding Path=ClientLibrary.Dependencies}"
4747
ToolTip="Dependencies for specialized library are used during compilation process."
4848
Foreground="{Binding Path=ClientLibrary.DependenciesColor}" />
4949
</DockPanel>
50+
<DataGrid Visibility="{Binding Path=ClientLibrary.NetStandardVisibility}"
51+
ItemsSource="{Binding Path=ClientLibrary.Nugets}"
52+
AutoGenerateColumns="False" CanUserAddRows="True" CanUserResizeColumns="True" CanUserDeleteRows="True">
53+
<DataGrid.Columns>
54+
<DataGridTextColumn Header="Nuget package" Binding="{Binding Project}" Width="*"/>
55+
<DataGridTextColumn Header="Version" Binding="{Binding Version}" Width="*"/>
56+
</DataGrid.Columns>
57+
</DataGrid>
5058
<CheckBox IsChecked="{Binding Path=ClientLibrary.WithActiveRecord}"
5159
Content="Active record"
5260
Margin="5"

VisualStudioPlugin/Gui/View/ConfigurationPocoControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Build C# classes based on DSL definition
3333
ToolTip="Target folder is used to place compiled library."
3434
Foreground="{Binding Path=PocoLibrary.TargetColor}"/>
3535
</DockPanel>
36-
<DockPanel Margin="5" Visibility="{Binding Path=PocoLibrary.LegacyVisibility}">
36+
<DockPanel Margin="5">
3737
<Button Content="Dependency path" Width="120"
3838
Command="{Binding ChangeDependencies}" CommandParameter="Poco" />
3939
<TextBox Text="{Binding Path=PocoLibrary.Dependencies}"

0 commit comments

Comments
 (0)