-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pushing up the first of the lucky winners
- Loading branch information
1 parent
c6c579f
commit ef063b8
Showing
613 changed files
with
423,273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# mstest test results | ||
TestResults | ||
|
||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Rr]elease/ | ||
x64/ | ||
*_i.c | ||
*_p.c | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper* | ||
|
||
# NCrunch | ||
*.ncrunch* | ||
.*crunch*.local.xml | ||
|
||
# Installshield output folder | ||
[Ee]xpress | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish | ||
|
||
# Publish Web Output | ||
*.Publish.xml | ||
|
||
# NuGet Packages Directory | ||
packages | ||
|
||
# Windows Azure Build Output | ||
csx | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Others | ||
[Bb]in | ||
[Oo]bj | ||
sql | ||
TestResults | ||
[Tt]est[Rr]esult* | ||
*.Cache | ||
ClientBin | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*.dbmdl | ||
Generated_Code #added for RIA/Silverlight projects | ||
|
||
# Backup & report files from converting an old project file to a newer | ||
# Visual Studio version. Backup files are not needed, because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<solution> | ||
<add key="disableSourceControlIntegration" value="true" /> | ||
</solution> | ||
<apikeys> | ||
<add key="https://www.nuget.org" value="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAjCr5LM920U6lEU/CELaK7wAAAAACAAAAAAADZgAAwAAAABAAAADnmgw+mlQ2eTBiGK8bhJ8vAAAAAASAAACgAAAAEAAAAEhpMT18Rd0d8JdQEXMAPyEoAAAA96yyR59bEGMrL4hOm027DMHqqaBtlcsuCoG84gnlPyI1tbKIrXnZOhQAAADg4DsgkTd5gv3FIEMY/GCe86Kvhw==" /> | ||
<add key="http://nuget.gw.symbolsource.org/Public/NuGet" value="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAjCr5LM920U6lEU/CELaK7wAAAAACAAAAAAADZgAAwAAAABAAAAAwv2wSYqzz6LV0tq2KpfkfAAAAAASAAACgAAAAEAAAAJuU95ELOYvqCM078yXz068oAAAAXlolusjNBgJtbe6l8T+x+a2mx1FW7HGLG+mEaNSnZjMlQlft8YIM7RQAAACeJvA+0CUHB+z2PC9DuhW1+d7tcw==" /> | ||
</apikeys> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir> | ||
|
||
<!-- Enable the restore command to run before builds --> | ||
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages> | ||
|
||
<!-- Property that enables building a package from a project --> | ||
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage> | ||
|
||
<!-- Determines if package restore consent is required to restore packages --> | ||
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent> | ||
|
||
<!-- Download NuGet.exe if it does not already exist --> | ||
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition=" '$(PackageSources)' == '' "> | ||
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config --> | ||
<!-- | ||
<PackageSource Include="https://nuget.org/api/v2/" /> | ||
<PackageSource Include="https://my-nuget-source/nuget/" /> | ||
--> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'"> | ||
<!-- Windows specific commands --> | ||
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath> | ||
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig> | ||
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'"> | ||
<!-- We need to launch nuget.exe with the mono command if we're not on windows --> | ||
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath> | ||
<PackagesConfig>packages.config</PackagesConfig> | ||
<PackagesDir>$(SolutionDir)packages</PackagesDir> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<!-- NuGet command --> | ||
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath> | ||
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources> | ||
|
||
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand> | ||
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand> | ||
|
||
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir> | ||
|
||
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch> | ||
<!-- Commands --> | ||
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)"</RestoreCommand> | ||
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand> | ||
|
||
<!-- Make the build depend on restore packages --> | ||
<BuildDependsOn Condition="$(RestorePackages) == 'true'"> | ||
RestorePackages; | ||
$(BuildDependsOn); | ||
</BuildDependsOn> | ||
|
||
<!-- Make the build depend on restore packages --> | ||
<BuildDependsOn Condition="$(BuildPackage) == 'true'"> | ||
$(BuildDependsOn); | ||
BuildPackage; | ||
</BuildDependsOn> | ||
</PropertyGroup> | ||
|
||
<Target Name="CheckPrerequisites"> | ||
<!-- Raise an error if we're unable to locate nuget.exe --> | ||
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" /> | ||
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " /> | ||
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" /> | ||
</Target> | ||
|
||
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites"> | ||
<Exec Command="$(RestoreCommand)" | ||
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" /> | ||
|
||
<Exec Command="$(RestoreCommand)" | ||
LogStandardErrorAsError="true" | ||
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" /> | ||
</Target> | ||
|
||
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites"> | ||
<Exec Command="$(BuildCommand)" | ||
Condition=" '$(OS)' != 'Windows_NT' " /> | ||
|
||
<Exec Command="$(BuildCommand)" | ||
LogStandardErrorAsError="true" | ||
Condition=" '$(OS)' == 'Windows_NT' " /> | ||
</Target> | ||
|
||
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | ||
<ParameterGroup> | ||
<OutputFilename ParameterType="System.String" Required="true" /> | ||
</ParameterGroup> | ||
<Task> | ||
<Reference Include="System.Core" /> | ||
<Using Namespace="System" /> | ||
<Using Namespace="System.IO" /> | ||
<Using Namespace="System.Net" /> | ||
<Using Namespace="Microsoft.Build.Framework" /> | ||
<Using Namespace="Microsoft.Build.Utilities" /> | ||
<Code Type="Fragment" Language="cs"> | ||
<![CDATA[ | ||
try { | ||
OutputFilename = Path.GetFullPath(OutputFilename); | ||
Log.LogMessage("Downloading latest version of NuGet.exe..."); | ||
WebClient webClient = new WebClient(); | ||
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename); | ||
return true; | ||
} | ||
catch (Exception ex) { | ||
Log.LogErrorFromException(ex); | ||
return false; | ||
} | ||
]]> | ||
</Code> | ||
</Task> | ||
</UsingTask> | ||
|
||
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | ||
<ParameterGroup> | ||
<EnvKey ParameterType="System.String" Required="true" /> | ||
<EnvValue ParameterType="System.String" Required="true" /> | ||
</ParameterGroup> | ||
<Task> | ||
<Using Namespace="System" /> | ||
<Code Type="Fragment" Language="cs"> | ||
<![CDATA[ | ||
try { | ||
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process); | ||
} | ||
catch { | ||
} | ||
]]> | ||
</Code> | ||
</Task> | ||
</UsingTask> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### bulky | ||
#### http://github.com/danielcrenna/copper | ||
|
||
Copyright (c) 2012 Conatus Creative Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR | ||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
bulky | ||
===== | ||
|
||
```powershell | ||
PM> Install-Package bulky | ||
``` | ||
|
||
Bulky is an idiomatic bulk insert interface for databases. It gives you the ability to use the | ||
native bulk copy mechanism of your database simply, using plain C# objects and an extension method on `IDbConnection`, much like how [Dapper](https://github.com/SamSaffron/dapper-dot-net) functions. | ||
|
||
### Why would I use this? | ||
- You want simple, high speed bulk inserts of large collections of objects | ||
- You need support for multiple databases (SQL Server, MySQL, and SQLite are supported today) | ||
- You use [copper](http://github.com/danielcrenna/copper), and you want to hook up a `BulkCopyConsumer` for high performance, periodic batching inserts | ||
- It works great with [tophat](http://github.com/danielcrenna/tophat) | ||
|
||
|
||
### Usage | ||
|
||
The hands-free usage is simple: | ||
|
||
```csharp | ||
using bulky; | ||
|
||
// Get your objects from somewhere | ||
IEnumerable<User> users = ReallyLargeCollectionOfUsers(); | ||
|
||
// Get your connection from somewhere else | ||
IDbConnection connection = GetMyDatabaseConnectionFromSomewhere(); | ||
|
||
// Profit! | ||
connection.BulkCopy(users); | ||
``` | ||
|
||
Behind the scenes, Bulky is using the provided bulk copy implementation. | ||
This is how you can change the underlying strategy: | ||
|
||
```csharp | ||
using bulky; | ||
|
||
// Change to MySQL multi-value inserts | ||
Bulky.BulkCopier = new MySqlBulkCopy(); | ||
|
||
// Change to SQLite's transactional flush | ||
Bulky.BulkCopier = new SqliteBulkCopy(); | ||
|
||
// Change to SQL Server's SqlBulkCopy (the default) | ||
Bulky.BulkCopier = new SqlServerBulkCopy(); | ||
``` | ||
|
||
### How does bulky map objects to database columns? | ||
|
||
Under the hood, bulky relies on a [TableDescriptor](http://github.com/danielcrenna/TableDescriptor) definition | ||
of a class in order to map it to database columns. By default, it uses TableDescriptor's built-in `SimpleDescriptor` | ||
to perform that mapping, but you can always pass in any implementation of `Descriptor`. The default conventions | ||
are simple enough, but if you have more advanced mapping needs you'll want to look at that project directly. | ||
For example, this `User` object will map to the database below: | ||
|
||
```csharp | ||
public class User | ||
{ | ||
public int Id { get; set; } | ||
public string Email { get; set; } | ||
} | ||
``` | ||
|
||
```sql | ||
CREATE TABLE [dbo].[User] | ||
( | ||
[Id] [int] IDENTITY(1,1) NOT NULL, | ||
[Email] [varchar](255) NOT NULL, | ||
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED ([Id] ASC) | ||
) | ||
``` | ||
|
||
### How do I use this with [copper](http://github.com/danielcrenna/copper)? | ||
|
||
Bulky includes a `BulkCopyConsumer` (in source, not in the distro) that will batch events handled by it and | ||
bulk insert them to the underlying database. By default, it uses [tophat](http://github.com/danielcrenna/tophat) for connection scoping | ||
(but you can provide your own `ConnectionBuilder` function), and [TableDescriptor](http://github.com/danielcrenna/TableDescriptor) for object mapping | ||
(but you can provide your own `Descriptor` for custom mapping). | ||
|
||
```csharp | ||
using tophat; | ||
using TableDescriptor; | ||
using bulky; | ||
|
||
// Consumer will bulk copy every 100 records, or every five seconds, whichever comes first | ||
var consumer = new BulkCopyConsumer<User>(100, TimeSpan.FromSeconds(5); | ||
|
||
// By default, the connection used by the consumer is tophat's current unit of work | ||
consumer.ConnectionBuilder = () => UnitOfWork.Current; | ||
|
||
// By default, the mapper used by the consumer is TableDescriptor's SimpleDescriptor | ||
consumer.Descriptor = SimpleDescriptor.Create<User>(); | ||
|
||
// These users could come from anywhere... | ||
var users = MyBigBagOfUsers() | ||
|
||
// Some producer is off obtaining users from somewhere, and bulk copying them in batches | ||
var producer = new CollectionProducer<User>(users).Consumes(consumer).Start(); | ||
``` |
Binary file not shown.
Oops, something went wrong.