-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
360c960
commit deb2588
Showing
15 changed files
with
93 additions
and
12 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
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
copy /y ..\Simple.Data\bin\Release\Simple.Data.dll Simple.Data.Core\lib\net40 | ||
copy /y ..\Simple.Data.Ado\bin\Release\Simple.Data.Ado.dll Simple.Data.Core\lib\net40 | ||
copy /y ..\Simple.Data.Ado\bin\Release\Simple.Data.Ado.dll Simple.Data.Ado\lib\net40 | ||
copy /y ..\Simple.Data.SqlServer\bin\Release\Simple.Data.SqlServer.dll Simple.Data.SqlServer\lib\net40 | ||
copy /y ..\Simple.Data.SqlCe35\bin\Release\Simple.Data.SqlCe35.dll Simple.Data.SqlCompact35\lib\net40 | ||
copy /y ..\Simple.Data.SqlCe40\bin\Release\Simple.Data.SqlCe40.dll Simple.Data.SqlCompact40\lib\net40 | ||
copy /y ..\Simple.Data.Mocking\bin\Release\Simple.Data.Mocking.dll Simple.Data.Mocking\lib\net40 |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
nuget pack Simple.Data.Core\Simple.Data.Core.nuspec | ||
nuget pack Simple.Data.Ado\Simple.Data.Ado.nuspec | ||
nuget pack Simple.Data.SqlServer\Simple.Data.SqlServer.nuspec | ||
nuget pack Simple.Data.SqlCompact40\Simple.Data.SqlCompact40.nuspec | ||
nuget pack Simple.Data.Mocking\Simple.Data.Mocking.nuspec |
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,17 @@ | ||
<?xml version="1.0"?> | ||
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<id>Simple.Data.Ado</id> | ||
<version>0.5.4</version> | ||
<authors>Mark Rendle</authors> | ||
<owners>Mark Rendle</owners> | ||
<description>ADO Adapter for the Simple.Data data access library.</description> | ||
<projectUrl>http://github.com/markrendle/Simple.Data</projectUrl> | ||
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl> | ||
<tags>sqlserver database data ado .net40</tags> | ||
<language>en-us</language> | ||
<dependencies> | ||
<dependency id="Simple.Data.Core" version="0.5.4" /> | ||
</dependencies> | ||
</metadata> | ||
</package> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
Binary file modified
BIN
+512 Bytes
(100%)
NuGet/Simple.Data.Mocking/lib/net40/Simple.Data.Mocking.dll
Binary file not shown.
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
Binary file modified
BIN
+0 Bytes
(100%)
NuGet/Simple.Data.SqlCompact40/lib/net40/Simple.Data.SqlCe40.dll
Binary file not shown.
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
Binary file modified
BIN
+0 Bytes
(100%)
NuGet/Simple.Data.SqlServer/lib/net40/Simple.Data.SqlServer.dll
Binary file not shown.
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,64 @@ | ||
# Fix | ||
An ultra-lightweight web glue for .NET, written in C#. | ||
## What? | ||
Fix joins together web servers, request handlers and "infixes", or middleware, in such a way that the implementations of each don't need to know anything about each other, or, indeed, about Fix itself. | ||
### Example? | ||
This is a Console application which runs a web server using Fix: | ||
|
||
class Program | ||
{ | ||
static void Main() | ||
{ | ||
using (var server = new Server("http://*:81/")) | ||
{ | ||
var fixer = new Fixer(server.Start, server.Stop); | ||
fixer.AddHandler(new RequestPrinter().PrintRequest); | ||
fixer.Start(); | ||
Console.Write("Running. Press Enter to stop."); | ||
Console.ReadLine(); | ||
fixer.Stop(); | ||
} | ||
} | ||
} | ||
Fixer, Server and RequestPrinter are all in separate assemblies, with no dependencies between them. The Console application has references to all the assemblies, and uses Fix to hook everything up. | ||
### More example? | ||
class Program | ||
{ | ||
static void Main() | ||
{ | ||
using (var server = new Server("http://*:81/")) | ||
{ | ||
var fixer = new Fixer(server.Start, server.Stop); | ||
fixer.AddHandler(new RequestPrinter().PrintRequest); | ||
fixer.AddHandler(new InfoPrinter().PrintInfo); | ||
fixer.AddInfix(new MethodDownshifter().DownshiftMethod); | ||
fixer.Start(); | ||
Console.Write("Running. Press Enter to stop."); | ||
Console.ReadLine(); | ||
fixer.Stop(); | ||
} | ||
} | ||
} | ||
In this case, we are adding two handlers, either of which could serve the request. We're also adding an Infix, which can modify the request before it is passed to the handlers. | ||
##Why? | ||
Partly because it's interesting to boil something like a web application server down to the bare minimum like this. | ||
|
||
More importantly, by relying entirely on .NET standard Action and Func delegates, Fix eliminates unnecessary coupling between classes and assemblies, as well as dependencies on itself. | ||
So you could write your own Fixer class and use that to wire up any servers, handlers or modules that would work with this "reference implementation". | ||
|
||
Another benefit is that because Fix takes a functional approach to the problem, it is friendlier to functional languages like F# and Clojure. | ||
And functional languages are ideal for writing web applications, which aren't supposed to maintain any state anyway. | ||
Ideally, a request will come in and be turned into a response by a series of operations. | ||
|
||
###Action and Func, eh? | ||
Yes, and the actual signatures are hideous. What I've done in this code is to add "using" aliases for them, to make it easier to read: | ||
|
||
using RequestHandler = System.Action<string, string, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, byte[], System.Action<int, string, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, byte[]>>; | ||
using ResponseHandler = System.Action<int, string, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, byte[]>; | ||
using Infix = System.Action<string, string, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, byte[], System.Action<int, string, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, byte[]>, System.Delegate>; | ||
##Production-ready? | ||
Good grief, no. There's a lot of discussion going on around this area at the moment (e.g. [the OWIN project](http://owin.github.com/owin)) | ||
and this is my contribution. The delegate signatures used are by no means ideal, particularly the *byte[]* type being used for the request | ||
and response bodies, which should probably be a *Func of byte[]* or a *Task of byte[]* or something. | ||
|
||
I'd love to hear people's thoughts on this. Best way is to catch me on [Twitter](http://twitter.com/markrendle). |