-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for nested complex types (#60) #61
Changes from 2 commits
e0ef01f
5b79518
efff016
bd2a856
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,117 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{DED8AB21-6D20-43F6-B9A7-522D63F34423}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>EfEnumToLookupTests</RootNamespace> | ||
<AssemblyName>EfEnumToLookupTests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<SignAssembly>true</SignAssembly> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AssemblyOriginatorKeyFile>EfEnumToLookup.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="EntityFramework"> | ||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="EntityFramework.SqlServer"> | ||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.Build.Framework" /> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.ComponentModel.DataAnnotations" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Model\Category.cs" /> | ||
<Compile Include="Model\Fur.cs" /> | ||
<Compile Include="Model\Pedigree.cs" /> | ||
<Compile Include="Model\Truck.cs" /> | ||
<Compile Include="Model\Car.cs" /> | ||
<Compile Include="Model\Vehicle.cs" /> | ||
<Compile Include="Model\Bed.cs" /> | ||
<Compile Include="Model\Chair.cs" /> | ||
<Compile Include="Model\Furniture.cs" /> | ||
<Compile Include="Model\Aspirations.cs" /> | ||
<Compile Include="Model\Cave.cs" /> | ||
<Compile Include="Db\MagicContext.cs" /> | ||
<Compile Include="Model\Constants.cs" /> | ||
<Compile Include="Model\Echo.cs" /> | ||
<Compile Include="Model\Eon.cs" /> | ||
<Compile Include="Model\Geology.cs" /> | ||
<Compile Include="Model\Heat.cs" /> | ||
<Compile Include="Model\Importance.cs" /> | ||
<Compile Include="Model\Pattern.cs" /> | ||
<Compile Include="Model\Relation.cs" /> | ||
<Compile Include="Model\Warren.cs" /> | ||
<Compile Include="Model\Chicken.cs" /> | ||
<Compile Include="Model\Ears.cs" /> | ||
<Compile Include="Model\Fox.cs" /> | ||
<Compile Include="Model\Legs.cs" /> | ||
<Compile Include="Model\Rabbit.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Db\TestInitializer.cs" /> | ||
<Compile Include="Tests\EnumParserTests.cs" /> | ||
<Compile Include="Tests\ModelParsingTests.cs" /> | ||
<Compile Include="Tests\TestConfiguration.cs" /> | ||
<Compile Include="Tests\TestStuff.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="EfEnumToLookup.snk" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\EfEnumToLookup\EfEnumToLookup.csproj"> | ||
<Project>{E6D4F1FB-D017-4BE2-AD13-90153BF479B1}</Project> | ||
<Name>EfEnumToLookup</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{DED8AB21-6D20-43F6-B9A7-522D63F34423}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>EfEnumToLookupTests</RootNamespace> | ||
<AssemblyName>EfEnumToLookupTests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<SignAssembly>true</SignAssembly> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AssemblyOriginatorKeyFile>EfEnumToLookup.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="EntityFramework"> | ||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="EntityFramework.SqlServer"> | ||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.Build.Framework" /> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.ComponentModel.DataAnnotations" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Model\Category.cs" /> | ||
<Compile Include="Model\Fur.cs" /> | ||
<Compile Include="Model\JellyBean.cs" /> | ||
<Compile Include="Model\CandyBag.cs" /> | ||
<Compile Include="Model\CandySize.cs" /> | ||
<Compile Include="Model\Pedigree.cs" /> | ||
<Compile Include="Model\CandyLook.cs" /> | ||
<Compile Include="Model\Lollipop.cs" /> | ||
<Compile Include="Model\ThreeChoicesOfLollipops.cs" /> | ||
<Compile Include="Model\Truck.cs" /> | ||
<Compile Include="Model\Car.cs" /> | ||
<Compile Include="Model\Vehicle.cs" /> | ||
<Compile Include="Model\Bed.cs" /> | ||
<Compile Include="Model\Chair.cs" /> | ||
<Compile Include="Model\Furniture.cs" /> | ||
<Compile Include="Model\Aspirations.cs" /> | ||
<Compile Include="Model\Cave.cs" /> | ||
<Compile Include="Db\MagicContext.cs" /> | ||
<Compile Include="Model\Constants.cs" /> | ||
<Compile Include="Model\Echo.cs" /> | ||
<Compile Include="Model\Eon.cs" /> | ||
<Compile Include="Model\Geology.cs" /> | ||
<Compile Include="Model\Heat.cs" /> | ||
<Compile Include="Model\Importance.cs" /> | ||
<Compile Include="Model\Pattern.cs" /> | ||
<Compile Include="Model\Relation.cs" /> | ||
<Compile Include="Model\Warren.cs" /> | ||
<Compile Include="Model\Chicken.cs" /> | ||
<Compile Include="Model\Ears.cs" /> | ||
<Compile Include="Model\Fox.cs" /> | ||
<Compile Include="Model\Legs.cs" /> | ||
<Compile Include="Model\Rabbit.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Db\TestInitializer.cs" /> | ||
<Compile Include="Tests\EnumParserTests.cs" /> | ||
<Compile Include="Tests\ModelParsingTests.cs" /> | ||
<Compile Include="Tests\TestConfiguration.cs" /> | ||
<Compile Include="Tests\TestStuff.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="EfEnumToLookup.snk" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\EfEnumToLookup\EfEnumToLookup.csproj"> | ||
<Project>{E6D4F1FB-D017-4BE2-AD13-90153BF479B1}</Project> | ||
<Name>EfEnumToLookup</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
--> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good choice of test names 👍 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was between a candy bag or perhaps an engine with parts, but candy won :) |
||
|
||
namespace EfEnumToLookupTests.Model | ||
{ | ||
[Table(nameof(CandyBag))] | ||
public class CandyBag | ||
{ | ||
public int Id { get; set; } | ||
public ThreeChoicesOfLollipops Lollipops { get; set; } | ||
public JellyBean Jellybeans { get; set; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace EfEnumToLookupTests.Model | ||
{ | ||
[ComplexType] | ||
public class CandyLook | ||
{ | ||
public string Shape { get; set; } | ||
public CandySize Size { get; set; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace EfEnumToLookupTests.Model | ||
{ | ||
public enum CandySize | ||
{ | ||
SMALL = 1, | ||
MEDIUM, | ||
LARGE | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace EfEnumToLookupTests.Model | ||
{ | ||
[ComplexType] | ||
public class JellyBean | ||
{ | ||
public int Count { get; set; } | ||
public CandyLook Look { get; set; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace EfEnumToLookupTests.Model | ||
{ | ||
[ComplexType] | ||
public class Lollipop | ||
{ | ||
public int Length { get; set; } | ||
public CandyLook Look { get; set; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace EfEnumToLookupTests.Model | ||
{ | ||
[ComplexType] | ||
public class ThreeChoicesOfLollipops | ||
{ | ||
public Lollipop Lollipop1 { get; set; } | ||
|
||
public Lollipop Lollipop2 { get; set; } | ||
|
||
public Lollipop Lollipop3 { get; set; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using System.Data.Entity; | ||
using EfEnumToLookup.LookupGenerator; | ||
using NUnit.Framework; | ||
|
@@ -64,6 +65,8 @@ public void ExampleOfGeneratingSql() | |
public class MyDbContext : DbContext | ||
{ | ||
public DbSet<Foo> Foos { get; set; } | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unintentional blank lines? |
||
|
||
} | ||
|
||
/// <summary> | ||
|
@@ -74,8 +77,25 @@ public class Foo | |
public int Id { get; set; } | ||
public Size Size { get; set; } | ||
public Shape Shape { get; set; } | ||
|
||
public Bar Bar { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation mismatch? |
||
} | ||
|
||
[ComplexType] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation looks off here too |
||
public class Bar | ||
{ | ||
public string Name { get; set; } | ||
public Tail Tail { get; set; } | ||
} | ||
|
||
[ComplexType] | ||
public class Tail | ||
{ | ||
public Size Size { get; set; } | ||
public Shape Shape { get; set; } | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Example enum that will be converted into a lookup table. | ||
/// </summary> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why's the whole file changed? line-endings or something?