Skip to content

Commit 3974f76

Browse files
committed
Move source code
1 parent b7c59ed commit 3974f76

28 files changed

+1719
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5+
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6+
</configSections>
7+
<startup>
8+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
9+
</startup>
10+
<entityFramework>
11+
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
12+
<providers>
13+
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
14+
</providers>
15+
</entityFramework>
16+
</configuration>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
using RandomLib;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel.DataAnnotations;
5+
using System.Data.Entity;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
namespace RandomConsole
11+
{
12+
static class Program
13+
{
14+
static void Main(string[] args)
15+
{
16+
InsertData();
17+
GetData();
18+
}
19+
20+
static void InsertData()
21+
{
22+
using (var db = new RandomTestDb())
23+
{
24+
for (int i = 0; i < 20; i++)
25+
{
26+
var id = RandomUtility.GenerateOrderedGuid2();
27+
var idSql = RandomUtility.GenerateOrderedSqlGuid2();
28+
var name = RandomUtility.GenerateAlphanumerics(20);
29+
30+
db.Categories.Add(new Category
31+
{
32+
Id = id.Guid.ToString(),
33+
Created = id.DateTime,
34+
Name = name,
35+
});
36+
db.Products.Add(new Product
37+
{
38+
Id = idSql.Guid,
39+
Created = id.DateTime,
40+
Name = name,
41+
});
42+
43+
//System.Threading.Thread.Sleep(1);
44+
}
45+
46+
db.SaveChanges();
47+
}
48+
}
49+
50+
static void GetData()
51+
{
52+
using (var db = new RandomTestDb())
53+
{
54+
var lower = new DateTime(2014, 4, 10, 14, 54, 59).ToSqlGuid2();
55+
var upper = new DateTime(2014, 4, 10, 14, 55, 1).ToSqlGuid2();
56+
57+
var products = db.Products
58+
.Where(p => p.Id.CompareTo(lower) > 0)
59+
.Where(p => p.Id.CompareTo(upper) < 0)
60+
.ToArray();
61+
62+
foreach (var item in products)
63+
{
64+
Console.WriteLine(item.Created);
65+
}
66+
}
67+
}
68+
69+
public static Guid ToSqlGuid(this DateTime dateTime)
70+
{
71+
return new Guid(0, 0, 0, dateTime.ToBytesForSqlGuid());
72+
}
73+
74+
public static Guid ToSqlGuid2(this DateTime dateTime)
75+
{
76+
return new Guid(new byte[10].Concat(dateTime.ToBytes2()).ToArray());
77+
}
78+
}
79+
80+
public class RandomTestDb : DbContext
81+
{
82+
public DbSet<Category> Categories { get; set; }
83+
public DbSet<Product> Products { get; set; }
84+
}
85+
86+
public class Category
87+
{
88+
[MaxLength(36)]
89+
public string Id { get; set; }
90+
public DateTime Created { get; set; }
91+
[Required]
92+
[MaxLength(20)]
93+
public string Name { get; set; }
94+
}
95+
96+
public class Product
97+
{
98+
public Guid Id { get; set; }
99+
public DateTime Created { get; set; }
100+
[Required]
101+
[MaxLength(20)]
102+
public string Name { get; set; }
103+
}
104+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6+
// アセンブリに関連付けられている情報を変更するには、
7+
// これらの属性値を変更してください。
8+
[assembly: AssemblyTitle("RandomConsole")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("RandomConsole")]
13+
[assembly: AssemblyCopyright("Copyright © 2014")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18+
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19+
// その型の ComVisible 属性を true に設定してください。
20+
[assembly: ComVisible(false)]
21+
22+
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
23+
[assembly: Guid("e6e528df-5df6-469b-9ccc-980c5228f25c")]
24+
25+
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33+
// 既定値にすることができます:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{5C9CE8D8-F9F0-4F5C-9B0B-85AB4B8E0EB6}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>RandomConsole</RootNamespace>
11+
<AssemblyName>RandomConsole</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SccProjectName>SAK</SccProjectName>
15+
<SccLocalPath>SAK</SccLocalPath>
16+
<SccAuxPath>SAK</SccAuxPath>
17+
<SccProvider>SAK</SccProvider>
18+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
19+
<RestorePackages>true</RestorePackages>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<PlatformTarget>AnyCPU</PlatformTarget>
23+
<DebugSymbols>true</DebugSymbols>
24+
<DebugType>full</DebugType>
25+
<Optimize>false</Optimize>
26+
<OutputPath>bin\Debug\</OutputPath>
27+
<DefineConstants>DEBUG;TRACE</DefineConstants>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32+
<PlatformTarget>AnyCPU</PlatformTarget>
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="EntityFramework">
42+
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll</HintPath>
43+
</Reference>
44+
<Reference Include="EntityFramework.SqlServer">
45+
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
46+
</Reference>
47+
<Reference Include="System" />
48+
<Reference Include="System.ComponentModel.DataAnnotations" />
49+
<Reference Include="System.Core" />
50+
<Reference Include="System.Xml.Linq" />
51+
<Reference Include="System.Data.DataSetExtensions" />
52+
<Reference Include="Microsoft.CSharp" />
53+
<Reference Include="System.Data" />
54+
<Reference Include="System.Xml" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<Compile Include="Program.cs" />
58+
<Compile Include="Properties\AssemblyInfo.cs" />
59+
</ItemGroup>
60+
<ItemGroup>
61+
<None Include="App.config" />
62+
<None Include="packages.config" />
63+
</ItemGroup>
64+
<ItemGroup>
65+
<ProjectReference Include="..\RandomLib\RandomLib.csproj">
66+
<Project>{c5ba44d2-4dd0-47d2-9d08-ce2c2783a95f}</Project>
67+
<Name>RandomLib</Name>
68+
</ProjectReference>
69+
</ItemGroup>
70+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
71+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
72+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
73+
<PropertyGroup>
74+
<ErrorText>このプロジェクトは、このコンピューターにはない NuGet パッケージを参照しています。これらをダウンロードするには、NuGet パッケージの復元を有効にしてください。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。不足しているファイルは {0} です。</ErrorText>
75+
</PropertyGroup>
76+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
77+
</Target>
78+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
79+
Other similar extension points exist, see Microsoft.Common.targets.
80+
<Target Name="BeforeBuild">
81+
</Target>
82+
<Target Name="AfterBuild">
83+
</Target>
84+
-->
85+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="EntityFramework" version="6.1.0" targetFramework="net45" />
4+
</packages>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DA40575B-92CA-4DD2-A61C-FE1DFBC53CB0}"
5+
ProjectSection(SolutionItems) = preProject
6+
.nuget\NuGet.Config = .nuget\NuGet.Config
7+
.nuget\NuGet.exe = .nuget\NuGet.exe
8+
.nuget\NuGet.targets = .nuget\NuGet.targets
9+
EndProjectSection
10+
EndProject
11+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RandomWebApp", "RandomWebApp\RandomWebApp.csproj", "{66B8665F-4A81-4DFB-AEAE-7E74B908A30E}"
12+
EndProject
13+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RandomLib", "RandomLib\RandomLib.csproj", "{C5BA44D2-4DD0-47D2-9D08-CE2C2783A95F}"
14+
EndProject
15+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RandomConsole", "RandomConsole\RandomConsole.csproj", "{5C9CE8D8-F9F0-4F5C-9B0B-85AB4B8E0EB6}"
16+
EndProject
17+
Global
18+
GlobalSection(TeamFoundationVersionControl) = preSolution
19+
SccNumberOfProjects = 4
20+
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
21+
SccTeamFoundationServer = https://saka-pon-apps14.visualstudio.com/defaultcollection
22+
SccLocalPath0 = .
23+
SccProjectUniqueName1 = RandomWebApp\\RandomWebApp.csproj
24+
SccProjectName1 = RandomWebApp
25+
SccLocalPath1 = RandomWebApp
26+
SccProjectUniqueName2 = RandomLib\\RandomLib.csproj
27+
SccProjectName2 = RandomLib
28+
SccLocalPath2 = RandomLib
29+
SccProjectUniqueName3 = RandomConsole\\RandomConsole.csproj
30+
SccProjectName3 = RandomConsole
31+
SccLocalPath3 = RandomConsole
32+
EndGlobalSection
33+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
34+
Debug|Any CPU = Debug|Any CPU
35+
Release|Any CPU = Release|Any CPU
36+
EndGlobalSection
37+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
38+
{66B8665F-4A81-4DFB-AEAE-7E74B908A30E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{66B8665F-4A81-4DFB-AEAE-7E74B908A30E}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{66B8665F-4A81-4DFB-AEAE-7E74B908A30E}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{66B8665F-4A81-4DFB-AEAE-7E74B908A30E}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{C5BA44D2-4DD0-47D2-9D08-CE2C2783A95F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{C5BA44D2-4DD0-47D2-9D08-CE2C2783A95F}.Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{C5BA44D2-4DD0-47D2-9D08-CE2C2783A95F}.Release|Any CPU.ActiveCfg = Release|Any CPU
45+
{C5BA44D2-4DD0-47D2-9D08-CE2C2783A95F}.Release|Any CPU.Build.0 = Release|Any CPU
46+
{5C9CE8D8-F9F0-4F5C-9B0B-85AB4B8E0EB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{5C9CE8D8-F9F0-4F5C-9B0B-85AB4B8E0EB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{5C9CE8D8-F9F0-4F5C-9B0B-85AB4B8E0EB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
49+
{5C9CE8D8-F9F0-4F5C-9B0B-85AB4B8E0EB6}.Release|Any CPU.Build.0 = Release|Any CPU
50+
EndGlobalSection
51+
GlobalSection(SolutionProperties) = preSolution
52+
HideSolutionNode = FALSE
53+
EndGlobalSection
54+
EndGlobal
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6+
// アセンブリに関連付けられている情報を変更するには、
7+
// これらの属性値を変更してください。
8+
[assembly: AssemblyTitle("RandomLib")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("RandomLib")]
13+
[assembly: AssemblyCopyright("Copyright © 2014")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18+
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19+
// その型の ComVisible 属性を true に設定してください。
20+
[assembly: ComVisible(false)]
21+
22+
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
23+
[assembly: Guid("deba08fb-d23a-4719-9985-ee6028b018c3")]
24+
25+
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33+
// 既定値にすることができます:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)