Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
</configuration>
4 changes: 3 additions & 1 deletion DbmlToClass.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
<OutputType>WinExe</OutputType>
<RootNamespace>DbmlToClass</RootNamespace>
<AssemblyName>DbmlToClass</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -64,6 +65,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand Down
79 changes: 58 additions & 21 deletions FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions FormMain.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;

namespace DbmlToClass
{
Expand Down Expand Up @@ -53,7 +46,7 @@ private void buttonStart_Click(object sender, EventArgs e)

if (!Directory.Exists(textBoxOutputFolder.Text))
{
if (MessageBox.Show("The specified output folder could not be located. Do you want to create it?") == DialogResult.Yes)
if (MessageBox.Show("The specified output folder could not be located. Do you want to create it?", "Action", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
try
{
Expand Down Expand Up @@ -95,7 +88,7 @@ private void buttonStart_Click(object sender, EventArgs e)

classText += "using System;" + "\r\n";
classText += "" + "\r\n";
classText += "namespace TemporaryNamespace" + "\r\n";
classText += "namespace " + txtNameSpace.Text + "\r\n";
classText += "{" + "\r\n";
classText += " public class " + typeName + "\r\n";
classText += " {" + "\r\n";
Expand All @@ -105,6 +98,11 @@ private void buttonStart_Click(object sender, EventArgs e)
if (columnNode.Name == "Column")
{
Type type = Type.GetType(columnNode.Attributes["Type"].Value);

// if type is null?
if (type == null)
type = Type.GetType("System.String");

bool isNullable = bool.Parse(columnNode.Attributes["CanBeNull"].Value) && type.IsValueType;
string name = columnNode.Attributes["Name"].Value;

Expand All @@ -122,6 +120,7 @@ private void buttonStart_Click(object sender, EventArgs e)
}

MessageBox.Show("Done!");
Process.Start(textBoxOutputFolder.Text);
}
}
}
44 changes: 18 additions & 26 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 9 additions & 13 deletions Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.