├── screenshots ├── SelectStatement.png └── StoredProcedure.png ├── .gitignore ├── DapperPocos ├── packages.config ├── Program.cs ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Settings.Designer.cs │ └── Resources.resx ├── ParameterDetails.cs ├── App.config ├── DapperPocos.csproj ├── MainForm.resx ├── MainForm.cs ├── SqlConnectionPocoExtension.cs └── MainForm.Designer.cs ├── LICENSE ├── README.md ├── LICENSE.rtf ├── DapperPocos.Installer ├── DapperPocos.Installer.wixproj └── Product.wxs └── DapperPocos.sln /screenshots/SelectStatement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcdon-ron/dapper-pocos/HEAD/screenshots/SelectStatement.png -------------------------------------------------------------------------------- /screenshots/StoredProcedure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcdon-ron/dapper-pocos/HEAD/screenshots/StoredProcedure.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /packages 2 | /DapperPocos.Installer/bin 3 | /DapperPocos.Installer/obj 4 | /DapperPocos/bin 5 | /DapperPocos/obj 6 | /DapperPocos/.vs 7 | /.vs 8 | -------------------------------------------------------------------------------- /DapperPocos/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /DapperPocos/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace DapperPocos 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DapperPocos/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Normal 7 | 8 | 9 | 0, 0, 0, 0 10 | 11 | 12 | 0 13 | 14 | 15 | 0 16 | 17 | 18 | 0 19 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 mcdon-ron 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dapper-pocos 2 | 3 | A small utility for generating POCOs / DTOs for use with Dapper connecting to SQL Server. 4 | 5 | Dapper POCOs uses "[sp_HELP](https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-help-transact-sql)" and "[sp_describe_first_result_set](https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-describe-first-result-set-transact-sql)" in SQL Server to get the input and output parameters for a given stored procedure or query. The [SQL Server data types](https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings) are mapped to their equivalent [C# data types](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/built-in-types-table), with [xml mapped to XDocument](https://stackoverflow.com/questions/1542073/xdocument-or-xmldocument/1542101#1542101). 6 | 7 | ## Screen Shots 8 | 9 | **Stored Procedure Example** 10 | 11 | ![Stored Procedure Screen Shot](screenshots/StoredProcedure.png) 12 | 13 | 14 | **Select Statement Example** 15 | 16 | ![Select Statement Screen Shot](screenshots/SelectStatement.png) 17 | -------------------------------------------------------------------------------- /DapperPocos/ParameterDetails.cs: -------------------------------------------------------------------------------- 1 | namespace PocoExtension 2 | { 3 | public class ParameterDetails 4 | { 5 | public int object_id { get; set; } 6 | public string name { get; set; } // Length: 128 7 | public int parameter_id { get; set; } 8 | public byte system_type_id { get; set; } 9 | public int user_type_id { get; set; } 10 | public short max_length { get; set; } 11 | public byte precision { get; set; } 12 | public byte scale { get; set; } 13 | public bool is_output { get; set; } 14 | public bool is_cursor_ref { get; set; } 15 | public bool has_default_value { get; set; } 16 | public bool is_xml_document { get; set; } 17 | // TODO: Add Mapping for Unknown SQL Server Data Type: sql_variant 18 | // nullable type: True 19 | // public object default_value { get; set; } 20 | public int xml_collection_id { get; set; } 21 | public bool is_readonly { get; set; } 22 | public bool? is_nullable { get; set; } 23 | public int? encryption_type { get; set; } 24 | public string encryption_type_desc { get; set; } // Length: 64 25 | public string encryption_algorithm_name { get; set; } // Length: 128 26 | public int? column_encryption_key_id { get; set; } 27 | public string column_encryption_key_database_name { get; set; } // Length: 128 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Courier New;}} 2 | {\*\generator Riched20 10.0.16299}\viewkind4\uc1 3 | \pard\f0\fs18\lang1033 MIT License\par 4 | \par 5 | Copyright (c) 2018 mcdon-ron\par 6 | \par 7 | Permission is hereby granted, free of charge, to any person obtaining a copy\par 8 | of this software and associated documentation files (the "Software"), to deal\par 9 | in the Software without restriction, including without limitation the rights\par 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\par 11 | copies of the Software, and to permit persons to whom the Software is\par 12 | furnished to do so, subject to the following conditions:\par 13 | \par 14 | The above copyright notice and this permission notice shall be included in all\par 15 | copies or substantial portions of the Software.\par 16 | \par 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\par 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\par 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\par 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\par 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\par 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\par 23 | SOFTWARE.\par 24 | \par 25 | } 26 | -------------------------------------------------------------------------------- /DapperPocos/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Normal 15 | 16 | 17 | 0, 0, 0, 0 18 | 19 | 20 | 0 21 | 22 | 23 | 0 24 | 25 | 26 | 0 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /DapperPocos/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Dapper Pocos")] 9 | [assembly: AssemblyDescription("Generate POCO's for use with Dapper")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("mcdon-ron")] 12 | [assembly: AssemblyProduct("Dapper Pocos")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cc9cd138-e822-44c9-82a6-6bb2f4117b0f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.8.0")] 36 | [assembly: AssemblyFileVersion("1.0.8.0")] 37 | -------------------------------------------------------------------------------- /DapperPocos.Installer/DapperPocos.Installer.wixproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 3.10 7 | 129afa78-15c6-48b0-95bc-d01034387f2c 8 | 2.0 9 | Dapper POCOs 10 | Package 11 | 12 | 13 | bin\$(Configuration)\ 14 | obj\$(Configuration)\ 15 | Debug 16 | 17 | 18 | bin\$(Configuration)\ 19 | obj\$(Configuration)\ 20 | 21 | 22 | 23 | 24 | 25 | 26 | $(WixExtDir)\WixUIExtension.dll 27 | WixUIExtension 28 | 29 | 30 | 31 | 32 | DapperPocos 33 | {cc9cd138-e822-44c9-82a6-6bb2f4117b0f} 34 | True 35 | True 36 | Binaries;Content;Satellites 37 | INSTALLFOLDER 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 53 | -------------------------------------------------------------------------------- /DapperPocos/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DapperPocos.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DapperPocos.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /DapperPocos.Installer/Product.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /DapperPocos.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2037 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DapperPocos", "DapperPocos\DapperPocos.csproj", "{CC9CD138-E822-44C9-82A6-6BB2F4117B0F}" 7 | EndProject 8 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "DapperPocos.Installer", "DapperPocos.Installer\DapperPocos.Installer.wixproj", "{129AFA78-15C6-48B0-95BC-D01034387F2C}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{D8E5D19A-818A-455B-9F6B-479B2324071E}" 11 | ProjectSection(SolutionItems) = preProject 12 | LICENSE = LICENSE 13 | LICENSE.rtf = LICENSE.rtf 14 | README.md = README.md 15 | EndProjectSection 16 | EndProject 17 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "screenshots", "screenshots", "{69FEB032-C949-4194-B753-F38C3582FC09}" 18 | ProjectSection(SolutionItems) = preProject 19 | screenshots\SelectStatement.png = screenshots\SelectStatement.png 20 | screenshots\StoredProcedure.png = screenshots\StoredProcedure.png 21 | EndProjectSection 22 | EndProject 23 | Global 24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 | Debug|Any CPU = Debug|Any CPU 26 | Debug|x86 = Debug|x86 27 | Release|Any CPU = Release|Any CPU 28 | Release|x86 = Release|x86 29 | EndGlobalSection 30 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 31 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Debug|x86.ActiveCfg = Debug|Any CPU 34 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Debug|x86.Build.0 = Debug|Any CPU 35 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Release|x86.ActiveCfg = Release|Any CPU 38 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F}.Release|x86.Build.0 = Release|Any CPU 39 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Debug|Any CPU.ActiveCfg = Debug|x86 40 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Debug|Any CPU.Build.0 = Debug|x86 41 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Debug|x86.ActiveCfg = Debug|x86 42 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Debug|x86.Build.0 = Debug|x86 43 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Release|Any CPU.ActiveCfg = Release|x86 44 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Release|Any CPU.Build.0 = Release|x86 45 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Release|x86.ActiveCfg = Release|x86 46 | {129AFA78-15C6-48B0-95BC-D01034387F2C}.Release|x86.Build.0 = Release|x86 47 | EndGlobalSection 48 | GlobalSection(SolutionProperties) = preSolution 49 | HideSolutionNode = FALSE 50 | EndGlobalSection 51 | GlobalSection(NestedProjects) = preSolution 52 | {69FEB032-C949-4194-B753-F38C3582FC09} = {D8E5D19A-818A-455B-9F6B-479B2324071E} 53 | EndGlobalSection 54 | GlobalSection(ExtensibilityGlobals) = postSolution 55 | SolutionGuid = {1762BC73-1926-44E5-A01F-4D9CAE69A828} 56 | EndGlobalSection 57 | EndGlobal 58 | -------------------------------------------------------------------------------- /DapperPocos/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DapperPocos.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("Normal")] 29 | public global::System.Windows.Forms.FormWindowState WindowState { 30 | get { 31 | return ((global::System.Windows.Forms.FormWindowState)(this["WindowState"])); 32 | } 33 | set { 34 | this["WindowState"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("0, 0, 0, 0")] 41 | public global::System.Drawing.Rectangle WindowPosition { 42 | get { 43 | return ((global::System.Drawing.Rectangle)(this["WindowPosition"])); 44 | } 45 | set { 46 | this["WindowPosition"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 53 | public int SplitterConnectionString { 54 | get { 55 | return ((int)(this["SplitterConnectionString"])); 56 | } 57 | set { 58 | this["SplitterConnectionString"] = value; 59 | } 60 | } 61 | 62 | [global::System.Configuration.UserScopedSettingAttribute()] 63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 65 | public int SplitterSelectOrSproc { 66 | get { 67 | return ((int)(this["SplitterSelectOrSproc"])); 68 | } 69 | set { 70 | this["SplitterSelectOrSproc"] = value; 71 | } 72 | } 73 | 74 | [global::System.Configuration.UserScopedSettingAttribute()] 75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 76 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 77 | public int SplitterOutput { 78 | get { 79 | return ((int)(this["SplitterOutput"])); 80 | } 81 | set { 82 | this["SplitterOutput"] = value; 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /DapperPocos/DapperPocos.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {CC9CD138-E822-44C9-82A6-6BB2F4117B0F} 8 | WinExe 9 | DapperPocos 10 | DapperPocos 11 | v4.7.1 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\Dapper.2.1.35\lib\net461\Dapper.dll 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Form 53 | 54 | 55 | MainForm.cs 56 | 57 | 58 | 59 | 60 | 61 | 62 | MainForm.cs 63 | Designer 64 | 65 | 66 | ResXFileCodeGenerator 67 | Resources.Designer.cs 68 | Designer 69 | 70 | 71 | True 72 | Resources.resx 73 | True 74 | 75 | 76 | 77 | SettingsSingleFileGenerator 78 | Settings.Designer.cs 79 | 80 | 81 | True 82 | Settings.settings 83 | True 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /DapperPocos/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /DapperPocos/MainForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 125, 17 125 | 126 | -------------------------------------------------------------------------------- /DapperPocos/MainForm.cs: -------------------------------------------------------------------------------- 1 | using PocoExtension; 2 | using System; 3 | using System.Data.SqlClient; 4 | using System.Drawing; 5 | using System.IO; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | 9 | namespace DapperPocos 10 | { 11 | public partial class MainForm : Form 12 | { 13 | public MainForm() 14 | { 15 | InitializeComponent(); 16 | 17 | RestoreWindow(); 18 | } 19 | 20 | private void btnSavePocos_Click(object sender, EventArgs e) 21 | { 22 | try 23 | { 24 | if (txbInputPoco.Lines.Length > 0) 25 | { 26 | saveFileDialog.Title = "Input Poco Save As"; 27 | if (saveFileDialog.ShowDialog() == DialogResult.OK) 28 | File.WriteAllLines(saveFileDialog.FileName, txbInputPoco.Lines, Encoding.UTF8); 29 | } 30 | 31 | if (txbOutputPoco.Lines.Length > 0) 32 | { 33 | saveFileDialog.Title = "Output Poco Save As"; 34 | if (saveFileDialog.ShowDialog() == DialogResult.OK) 35 | File.WriteAllLines(saveFileDialog.FileName, txbOutputPoco.Lines, Encoding.UTF8); 36 | } 37 | } 38 | catch (Exception ex) 39 | { 40 | MessageBox.Show(ex.ToString(), "Failed to Save Pocos", MessageBoxButtons.OK, MessageBoxIcon.Error); 41 | } 42 | } 43 | 44 | private void btnGenerate_Click(object sender, EventArgs e) 45 | { 46 | try 47 | { 48 | var sprocOrSelect = txbSprocOrSelect.Text; 49 | if (string.IsNullOrEmpty(sprocOrSelect)) 50 | return; 51 | 52 | var isSelectStatement = sprocOrSelect.Trim().StartsWith("SELECT", StringComparison.OrdinalIgnoreCase); 53 | using (var con = new SqlConnection(txbConnectionString.Text)) 54 | { 55 | txbOutputPoco.Text = con.GetOutputPoco(sprocOrSelect); 56 | // can't get an input poco for a select statement, would throw a SqlException 57 | // looks like "sp_HELP" is only valid for stored procedures 58 | //txbInputPoco.Text = con.GetInputPoco(sprocOrSelect); 59 | if (!isSelectStatement) 60 | txbInputPoco.Text = con.GetInputPoco(sprocOrSelect); 61 | else 62 | txbInputPoco.Text = string.Empty; 63 | } 64 | } 65 | catch (Exception ex) 66 | { 67 | MessageBox.Show(ex.ToString(), "Failed to Generate Pocos", MessageBoxButtons.OK, MessageBoxIcon.Error); 68 | } 69 | } 70 | 71 | private bool IsVisibleOnAnyScreen(Rectangle rect) 72 | { 73 | foreach (var screen in Screen.AllScreens) 74 | { 75 | if (screen.WorkingArea.IntersectsWith(rect)) 76 | return true; 77 | } 78 | 79 | return false; 80 | } 81 | 82 | // Window size/position save/restore logic based on 83 | // https://stackoverflow.com/questions/937298/restoring-window-size-position-with-multiple-monitors 84 | private void RestoreWindow() 85 | { 86 | var settings = Properties.Settings.Default; 87 | 88 | // set defaults for WindowState and StartPosition 89 | WindowState = FormWindowState.Normal; 90 | StartPosition = FormStartPosition.WindowsDefaultLocation; 91 | 92 | var restorePosition = settings.WindowPosition; 93 | var restoreState = settings.WindowState; 94 | 95 | if (restorePosition != Rectangle.Empty) 96 | { 97 | // check if the saved bounds are nonzero and visible on any screen 98 | if (IsVisibleOnAnyScreen(restorePosition)) 99 | { 100 | // first set the bounds 101 | StartPosition = FormStartPosition.Manual; 102 | DesktopBounds = restorePosition; 103 | } 104 | else // the restorePosition was invalid, but can still apply the saved size 105 | { 106 | Size = restorePosition.Size; 107 | } 108 | } 109 | 110 | // afterwards, if the window wasn't minimized, will restore WindowState 111 | // otherwise had previously defaulted WindowState to Normal 112 | if (restoreState != FormWindowState.Minimized) 113 | WindowState = restoreState; 114 | 115 | RestoreSplitter(splitterConnectionString, settings.SplitterConnectionString); 116 | RestoreSplitter(splitterSelectOrSproc, settings.SplitterSelectOrSproc); 117 | RestoreSplitter(splitterOutput, settings.SplitterOutput); 118 | } 119 | 120 | private void RestoreSplitter(Splitter splitter, int splitPosition) 121 | { 122 | if (splitPosition > splitter.MinSize) 123 | splitter.SplitPosition = splitPosition; 124 | } 125 | 126 | private void SaveWindow() 127 | { 128 | var settings = Properties.Settings.Default; 129 | 130 | // only save the WindowState if Normal or Maximized 131 | switch (WindowState) 132 | { 133 | // if Normal, save WindowState and DesktopBounds 134 | case FormWindowState.Normal: 135 | settings.WindowPosition = DesktopBounds; 136 | settings.WindowState = WindowState; 137 | break; 138 | // if Maximized, save WindowState and RestoreBounds 139 | case FormWindowState.Maximized: 140 | settings.WindowPosition = RestoreBounds; 141 | settings.WindowState = WindowState; 142 | break; 143 | // if Minimized, save WindowState as Normal and RestoreBounds 144 | case FormWindowState.Minimized: 145 | settings.WindowPosition = RestoreBounds; 146 | settings.WindowState = FormWindowState.Normal; 147 | break; 148 | } 149 | 150 | settings.SplitterConnectionString = splitterConnectionString.SplitPosition; 151 | settings.SplitterSelectOrSproc = splitterSelectOrSproc.SplitPosition; 152 | settings.SplitterOutput = splitterOutput.SplitPosition; 153 | 154 | settings.Save(); 155 | } 156 | 157 | private void MainForm_FormClosing(object sender, FormClosingEventArgs e) 158 | { 159 | SaveWindow(); 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /DapperPocos/SqlConnectionPocoExtension.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Data; 3 | using System.Data.SqlClient; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace PocoExtension 8 | { 9 | public static class SqlConnectionPocoExtension 10 | { 11 | 12 | public static string GetInputPoco(this SqlConnection sqlConnection, string storedProcedureName) 13 | { 14 | var sql = @" 15 | SELECT * 16 | FROM sys.parameters p 17 | WHERE p.[object_id] = object_id(@objName) 18 | "; 19 | // querying sys.parameters to find out if the parameters are nullable 20 | // and if they are output parameters 21 | var parmDetails = sqlConnection.Query(sql, new { objName = storedProcedureName }, commandType: CommandType.Text); 22 | 23 | var set = sqlConnection.QueryMultiple("sp_HELP", new { objname = storedProcedureName }, commandType: CommandType.StoredProcedure); 24 | set.Read(); 25 | if (set.IsConsumed) 26 | return "// N/A"; 27 | 28 | var list = set.Read(); 29 | var sb = new StringBuilder(); 30 | 31 | sb.AppendLine("public class InputPoco"); 32 | sb.AppendLine("{"); 33 | 34 | foreach (var item in list) 35 | { 36 | string name = item.Parameter_name; 37 | var trimmedName = name.TrimStart('@'); 38 | string type = item.Type; 39 | 40 | // length in bytes 41 | var length = item.Length; 42 | 43 | string stype = type; 44 | 45 | // if a string type, add the length specifier 46 | // for char and varchar 1 byte per character 47 | if(type == "char" || type == "varchar") 48 | { 49 | if(length == -1) 50 | stype += "(max)"; 51 | else 52 | stype += "(" + length + ")"; 53 | } 54 | // for nchar and nvarchar 2 bytes per character 55 | else if (type == "nchar" || type == "nvarchar") 56 | { 57 | if(length == -1) 58 | stype += "(max)"; 59 | else 60 | stype += "(" + length / 2 + ")"; 61 | } 62 | 63 | var details = parmDetails.Single(x => x.name == name); 64 | var nullable = details.is_nullable == true; 65 | var isOutput = details.is_output; 66 | 67 | AppendProperty(sb, stype, nullable, isOutput, trimmedName); 68 | } 69 | 70 | sb.AppendLine("}"); 71 | return sb.ToString(); 72 | } 73 | 74 | public static string GetOutputPoco(this SqlConnection sqlConnection, string sql) 75 | { 76 | var list = sqlConnection.Query("sp_describe_first_result_set", new { tsql = sql }, commandType: CommandType.StoredProcedure); 77 | var sb = new StringBuilder(); 78 | sb.AppendLine("public class OutputPoco"); 79 | sb.AppendLine("{"); 80 | foreach (var item in list) 81 | { 82 | string name = item.name; 83 | string sqlType = item.system_type_name; 84 | bool nullable = item.is_nullable; 85 | // the output parameters only apply to input poco 86 | bool isOutput = false; 87 | 88 | AppendProperty(sb, sqlType, nullable, isOutput, name); 89 | } 90 | sb.AppendLine("}"); 91 | return sb.ToString(); 92 | } 93 | 94 | private static void AppendProperty(StringBuilder stringBuilder, string sqlType, bool nullable, bool isOutput, string name) 95 | { 96 | sqlType = sqlType.Trim(); 97 | 98 | // handle null or empty column names 99 | if (name != null) 100 | name = name.Trim(); 101 | 102 | string cc = string.Empty; 103 | 104 | if(string.IsNullOrEmpty(name)) 105 | { 106 | // convert to string representation of null or empty 107 | name = name == null ? "null" : "string.Empty"; 108 | cc = "//"; // preparing to comment out related property in OutputPoco 109 | stringBuilder.AppendLine($" // TODO: Commenting out property because Column Name is {name}."); 110 | } 111 | 112 | string csType = null; 113 | string length = null; 114 | if (TryMap(sqlType, nullable, out csType, out length)) 115 | { 116 | stringBuilder.Append($" {cc}public {csType} {name} {{ get; set; }}"); 117 | if (isOutput) 118 | stringBuilder.Append($" // IsOutput: {isOutput}"); 119 | //if ((csType == "string" || csType == "string?") && !string.IsNullOrEmpty(length)) 120 | // stringBuilder.Append($" // Length: {length}"); 121 | if (csType == "string" && !string.IsNullOrEmpty(length)) 122 | { 123 | stringBuilder.Append($" // Length: {length}"); 124 | if (nullable) 125 | stringBuilder.Append(" // Nullable"); 126 | } 127 | stringBuilder.AppendLine(); 128 | } 129 | else 130 | { 131 | stringBuilder.AppendLine($" // TODO: Add Mapping for Unknown SQL Server Data Type: {sqlType}"); 132 | stringBuilder.AppendLine($" // nullable type: {nullable}"); 133 | if (isOutput) 134 | stringBuilder.AppendLine($" // IsOutput: {isOutput}"); 135 | 136 | stringBuilder.AppendLine($" // public object {name} {{ get; set; }}"); 137 | } 138 | } 139 | 140 | private static string[] ParseSqlType(string sqlType) 141 | { 142 | var result = new string[] {null, null}; 143 | 144 | // split the type and any length specifier 145 | // like nvarchar(x) 146 | var parts = sqlType.Trim(')').Split('('); 147 | 148 | // the type name 149 | result[0] = parts[0].Trim().ToLower(); 150 | 151 | // if we have a length specifier 152 | if (parts.Length > 1) 153 | { 154 | // the length specifier 155 | result[1] = parts[1].Trim(); 156 | } 157 | 158 | return result; 159 | } 160 | 161 | public static bool TryMap(string sqlType, bool nullable, out string csType, out string stringLength) 162 | { 163 | // for handling nullable value types 164 | var n = nullable ? "?" : string.Empty; 165 | 166 | var parsedType = ParseSqlType(sqlType); 167 | var type = parsedType[0]; 168 | stringLength = parsedType[1]; 169 | 170 | // sql types that are commented out 171 | // are those I don't know how to 172 | // properly map to clr types 173 | switch (type) 174 | { 175 | case "bigint": 176 | csType = "long" + n; // Int64 177 | break; 178 | case "binary": 179 | case "image": 180 | //case "FILESTREAM": 181 | case "rowversion": 182 | case "timestamp": 183 | case "varbinary": 184 | csType = "byte[]"; // Byte[] 185 | break; 186 | case "bit": 187 | csType = "bool" + n; // Boolean 188 | break; 189 | case "text": 190 | case "ntext": 191 | csType = "string"; 192 | stringLength = type; 193 | break; 194 | case "char": 195 | case "nchar": 196 | case "varchar": 197 | case "nvarchar": 198 | if (stringLength == "1") 199 | csType = "char" + n; // Char 200 | else 201 | csType = "string"; // String 202 | break; 203 | case "date": 204 | case "datetime": 205 | case "datetime2": 206 | case "smalldatetime": 207 | csType = "DateTime" + n; 208 | break; 209 | case "datetimeoffset": 210 | csType = "DateTimeOffset" + n; 211 | break; 212 | case "decimal": 213 | case "money": 214 | case "numeric": 215 | case "smallmoney": 216 | csType = "decimal" + n; // Decimal 217 | break; 218 | case "float": 219 | csType = "double" + n; // Double 220 | break; 221 | case "int": 222 | csType = "int" + n; // Int32 223 | break; 224 | case "real": 225 | csType = "float" + n; // Single 226 | break; 227 | case "smallint": 228 | csType = "short" + n; // Int16 229 | break; 230 | //case "sql_variant": 231 | //return "Object"; 232 | case "time": 233 | csType = "TimeSpan" + n; 234 | break; 235 | case "tinyint": 236 | csType = "byte" + n; // Byte 237 | break; 238 | case "uniqueidentifier": 239 | csType = "Guid" + n; 240 | break; 241 | case "xml": 242 | // based on https://github.com/StackExchange/Dapper/issues/427 243 | // it appears Dapper can map the DbType "xml" to XmlDocument or XDocument or XElement 244 | // choosing XDocument based on https://stackoverflow.com/a/1542101/135280 245 | csType = "XDocument"; 246 | break; 247 | default: 248 | csType = null; 249 | return false; 250 | } 251 | return true; 252 | } 253 | } 254 | } 255 | -------------------------------------------------------------------------------- /DapperPocos/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DapperPocos 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.menuStrip = new System.Windows.Forms.MenuStrip(); 32 | this.btnGenerate = new System.Windows.Forms.ToolStripMenuItem(); 33 | this.btnSavePocos = new System.Windows.Forms.ToolStripMenuItem(); 34 | this.gbxConnectionString = new System.Windows.Forms.GroupBox(); 35 | this.txbConnectionString = new System.Windows.Forms.TextBox(); 36 | this.gbxSprocOrSelect = new System.Windows.Forms.GroupBox(); 37 | this.txbSprocOrSelect = new System.Windows.Forms.TextBox(); 38 | this.gbxInputPoco = new System.Windows.Forms.GroupBox(); 39 | this.txbInputPoco = new System.Windows.Forms.TextBox(); 40 | this.gbxOutputPoco = new System.Windows.Forms.GroupBox(); 41 | this.txbOutputPoco = new System.Windows.Forms.TextBox(); 42 | this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); 43 | this.pnlOutput = new System.Windows.Forms.Panel(); 44 | this.splitterOutput = new System.Windows.Forms.Splitter(); 45 | this.splitterConnectionString = new System.Windows.Forms.Splitter(); 46 | this.splitterSelectOrSproc = new System.Windows.Forms.Splitter(); 47 | this.menuStrip.SuspendLayout(); 48 | this.gbxConnectionString.SuspendLayout(); 49 | this.gbxSprocOrSelect.SuspendLayout(); 50 | this.gbxInputPoco.SuspendLayout(); 51 | this.gbxOutputPoco.SuspendLayout(); 52 | this.pnlOutput.SuspendLayout(); 53 | this.SuspendLayout(); 54 | // 55 | // menuStrip 56 | // 57 | this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 58 | this.btnGenerate, 59 | this.btnSavePocos}); 60 | this.menuStrip.Location = new System.Drawing.Point(0, 0); 61 | this.menuStrip.Name = "menuStrip"; 62 | this.menuStrip.Size = new System.Drawing.Size(800, 24); 63 | this.menuStrip.TabIndex = 0; 64 | this.menuStrip.Text = "menuStrip1"; 65 | // 66 | // btnGenerate 67 | // 68 | this.btnGenerate.Name = "btnGenerate"; 69 | this.btnGenerate.Size = new System.Drawing.Size(101, 20); 70 | this.btnGenerate.Text = "&Generate Pocos"; 71 | this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click); 72 | // 73 | // btnSavePocos 74 | // 75 | this.btnSavePocos.Name = "btnSavePocos"; 76 | this.btnSavePocos.Size = new System.Drawing.Size(78, 20); 77 | this.btnSavePocos.Text = "&Save Pocos"; 78 | this.btnSavePocos.Click += new System.EventHandler(this.btnSavePocos_Click); 79 | // 80 | // gbxConnectionString 81 | // 82 | this.gbxConnectionString.Controls.Add(this.txbConnectionString); 83 | this.gbxConnectionString.Dock = System.Windows.Forms.DockStyle.Top; 84 | this.gbxConnectionString.Location = new System.Drawing.Point(0, 24); 85 | this.gbxConnectionString.Name = "gbxConnectionString"; 86 | this.gbxConnectionString.Size = new System.Drawing.Size(800, 80); 87 | this.gbxConnectionString.TabIndex = 1; 88 | this.gbxConnectionString.TabStop = false; 89 | this.gbxConnectionString.Text = "Connection String"; 90 | // 91 | // txbConnectionString 92 | // 93 | this.txbConnectionString.Dock = System.Windows.Forms.DockStyle.Fill; 94 | this.txbConnectionString.Location = new System.Drawing.Point(3, 16); 95 | this.txbConnectionString.Multiline = true; 96 | this.txbConnectionString.Name = "txbConnectionString"; 97 | this.txbConnectionString.ScrollBars = System.Windows.Forms.ScrollBars.Both; 98 | this.txbConnectionString.Size = new System.Drawing.Size(794, 61); 99 | this.txbConnectionString.TabIndex = 0; 100 | // 101 | // gbxSprocOrSelect 102 | // 103 | this.gbxSprocOrSelect.Controls.Add(this.txbSprocOrSelect); 104 | this.gbxSprocOrSelect.Dock = System.Windows.Forms.DockStyle.Top; 105 | this.gbxSprocOrSelect.Location = new System.Drawing.Point(0, 107); 106 | this.gbxSprocOrSelect.Name = "gbxSprocOrSelect"; 107 | this.gbxSprocOrSelect.Size = new System.Drawing.Size(800, 80); 108 | this.gbxSprocOrSelect.TabIndex = 3; 109 | this.gbxSprocOrSelect.TabStop = false; 110 | this.gbxSprocOrSelect.Text = "Stored Procedure or SQL Select"; 111 | // 112 | // txbSprocOrSelect 113 | // 114 | this.txbSprocOrSelect.Dock = System.Windows.Forms.DockStyle.Fill; 115 | this.txbSprocOrSelect.Location = new System.Drawing.Point(3, 16); 116 | this.txbSprocOrSelect.Multiline = true; 117 | this.txbSprocOrSelect.Name = "txbSprocOrSelect"; 118 | this.txbSprocOrSelect.ScrollBars = System.Windows.Forms.ScrollBars.Both; 119 | this.txbSprocOrSelect.Size = new System.Drawing.Size(794, 61); 120 | this.txbSprocOrSelect.TabIndex = 0; 121 | // 122 | // gbxInputPoco 123 | // 124 | this.gbxInputPoco.Controls.Add(this.txbInputPoco); 125 | this.gbxInputPoco.Dock = System.Windows.Forms.DockStyle.Left; 126 | this.gbxInputPoco.Location = new System.Drawing.Point(0, 0); 127 | this.gbxInputPoco.Name = "gbxInputPoco"; 128 | this.gbxInputPoco.Size = new System.Drawing.Size(400, 260); 129 | this.gbxInputPoco.TabIndex = 0; 130 | this.gbxInputPoco.TabStop = false; 131 | this.gbxInputPoco.Text = "Input"; 132 | // 133 | // txbInputPoco 134 | // 135 | this.txbInputPoco.Dock = System.Windows.Forms.DockStyle.Fill; 136 | this.txbInputPoco.Location = new System.Drawing.Point(3, 16); 137 | this.txbInputPoco.Multiline = true; 138 | this.txbInputPoco.Name = "txbInputPoco"; 139 | this.txbInputPoco.ScrollBars = System.Windows.Forms.ScrollBars.Both; 140 | this.txbInputPoco.Size = new System.Drawing.Size(394, 241); 141 | this.txbInputPoco.TabIndex = 0; 142 | this.txbInputPoco.WordWrap = false; 143 | // 144 | // gbxOutputPoco 145 | // 146 | this.gbxOutputPoco.Controls.Add(this.txbOutputPoco); 147 | this.gbxOutputPoco.Dock = System.Windows.Forms.DockStyle.Fill; 148 | this.gbxOutputPoco.Location = new System.Drawing.Point(400, 0); 149 | this.gbxOutputPoco.Name = "gbxOutputPoco"; 150 | this.gbxOutputPoco.Size = new System.Drawing.Size(400, 260); 151 | this.gbxOutputPoco.TabIndex = 2; 152 | this.gbxOutputPoco.TabStop = false; 153 | this.gbxOutputPoco.Text = "Output"; 154 | // 155 | // txbOutputPoco 156 | // 157 | this.txbOutputPoco.Dock = System.Windows.Forms.DockStyle.Fill; 158 | this.txbOutputPoco.Location = new System.Drawing.Point(3, 16); 159 | this.txbOutputPoco.Multiline = true; 160 | this.txbOutputPoco.Name = "txbOutputPoco"; 161 | this.txbOutputPoco.ScrollBars = System.Windows.Forms.ScrollBars.Both; 162 | this.txbOutputPoco.Size = new System.Drawing.Size(394, 241); 163 | this.txbOutputPoco.TabIndex = 0; 164 | this.txbOutputPoco.WordWrap = false; 165 | // 166 | // saveFileDialog 167 | // 168 | this.saveFileDialog.Filter = "C# Files|*.cs|(All Files)|*.*"; 169 | // 170 | // pnlOutput 171 | // 172 | this.pnlOutput.Controls.Add(this.splitterOutput); 173 | this.pnlOutput.Controls.Add(this.gbxOutputPoco); 174 | this.pnlOutput.Controls.Add(this.gbxInputPoco); 175 | this.pnlOutput.Dock = System.Windows.Forms.DockStyle.Fill; 176 | this.pnlOutput.Location = new System.Drawing.Point(0, 190); 177 | this.pnlOutput.Name = "pnlOutput"; 178 | this.pnlOutput.Size = new System.Drawing.Size(800, 260); 179 | this.pnlOutput.TabIndex = 5; 180 | // 181 | // splitterOutput 182 | // 183 | this.splitterOutput.Location = new System.Drawing.Point(400, 0); 184 | this.splitterOutput.Name = "splitterOutput"; 185 | this.splitterOutput.Size = new System.Drawing.Size(3, 260); 186 | this.splitterOutput.TabIndex = 1; 187 | this.splitterOutput.TabStop = false; 188 | // 189 | // splitterConnectionString 190 | // 191 | this.splitterConnectionString.Dock = System.Windows.Forms.DockStyle.Top; 192 | this.splitterConnectionString.Location = new System.Drawing.Point(0, 104); 193 | this.splitterConnectionString.Name = "splitterConnectionString"; 194 | this.splitterConnectionString.Size = new System.Drawing.Size(800, 3); 195 | this.splitterConnectionString.TabIndex = 2; 196 | this.splitterConnectionString.TabStop = false; 197 | // 198 | // splitterSelectOrSproc 199 | // 200 | this.splitterSelectOrSproc.Dock = System.Windows.Forms.DockStyle.Top; 201 | this.splitterSelectOrSproc.Location = new System.Drawing.Point(0, 187); 202 | this.splitterSelectOrSproc.Name = "splitterSelectOrSproc"; 203 | this.splitterSelectOrSproc.Size = new System.Drawing.Size(800, 3); 204 | this.splitterSelectOrSproc.TabIndex = 4; 205 | this.splitterSelectOrSproc.TabStop = false; 206 | // 207 | // MainForm 208 | // 209 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 210 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 211 | this.ClientSize = new System.Drawing.Size(800, 450); 212 | this.Controls.Add(this.pnlOutput); 213 | this.Controls.Add(this.splitterSelectOrSproc); 214 | this.Controls.Add(this.gbxSprocOrSelect); 215 | this.Controls.Add(this.splitterConnectionString); 216 | this.Controls.Add(this.gbxConnectionString); 217 | this.Controls.Add(this.menuStrip); 218 | this.MainMenuStrip = this.menuStrip; 219 | this.Name = "MainForm"; 220 | this.Text = "Dapper Pocos"; 221 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); 222 | this.menuStrip.ResumeLayout(false); 223 | this.menuStrip.PerformLayout(); 224 | this.gbxConnectionString.ResumeLayout(false); 225 | this.gbxConnectionString.PerformLayout(); 226 | this.gbxSprocOrSelect.ResumeLayout(false); 227 | this.gbxSprocOrSelect.PerformLayout(); 228 | this.gbxInputPoco.ResumeLayout(false); 229 | this.gbxInputPoco.PerformLayout(); 230 | this.gbxOutputPoco.ResumeLayout(false); 231 | this.gbxOutputPoco.PerformLayout(); 232 | this.pnlOutput.ResumeLayout(false); 233 | this.ResumeLayout(false); 234 | this.PerformLayout(); 235 | 236 | } 237 | 238 | #endregion 239 | 240 | private System.Windows.Forms.MenuStrip menuStrip; 241 | private System.Windows.Forms.ToolStripMenuItem btnGenerate; 242 | private System.Windows.Forms.ToolStripMenuItem btnSavePocos; 243 | private System.Windows.Forms.GroupBox gbxConnectionString; 244 | private System.Windows.Forms.TextBox txbConnectionString; 245 | private System.Windows.Forms.GroupBox gbxInputPoco; 246 | private System.Windows.Forms.TextBox txbInputPoco; 247 | private System.Windows.Forms.GroupBox gbxOutputPoco; 248 | private System.Windows.Forms.TextBox txbOutputPoco; 249 | private System.Windows.Forms.SaveFileDialog saveFileDialog; 250 | private System.Windows.Forms.GroupBox gbxSprocOrSelect; 251 | private System.Windows.Forms.TextBox txbSprocOrSelect; 252 | private System.Windows.Forms.Panel pnlOutput; 253 | private System.Windows.Forms.Splitter splitterOutput; 254 | private System.Windows.Forms.Splitter splitterConnectionString; 255 | private System.Windows.Forms.Splitter splitterSelectOrSproc; 256 | } 257 | } 258 | 259 | --------------------------------------------------------------------------------