Sunday 9 December 2012

Simple.Data

What is Simple.Data?

As the name suggests it is Simple framework for manipulation of Data

Coming to what it really is : Simple.Data is a lightweight framework that uses the dynamic features of .NET 4 to provide an expressive, ORM-ish way of accessing and manipulating data without any of the code pre-generation and boilerplate required by other frameworks



Supported Databases


Simple.Data is designed to work with all kinds of data storage systems, SQL- and non-SQL-based. It has very simple, open and flexible Adaptor and Provider models which make it simple to write plug-ins to map to almost any back-end.
The core framework includes an ADO adaptor with a Provider model to access relational database systems. Those systems supported so far are:
  • SQL Server 2005 and later
  • SQL Server Compact Edition 4.0
  • Oracle
  • VistaDB
  • MySQL 4.0 and later
  • SQLite 3.0 and later
  • PostgreSQL
  • SQLAnywhere
  • Informix


Where to get Simple.Data

Via nuGet

Currently, the best way to get Simple.Data into your project is using the nuGet package manager. Install the package for the specific adapter or provider you want to use, and NuGet will install the necessary dependencies automatically. For example, if you are using SQL Server in your project, just go to the Package Manager Console and run:
PM> Install-Package Simple.Data.SqlServer
This will install the Core package, the Ado adaptor package, and the Provider for SQL Server.


NancyFx

What is NancyFx?


Nancy is a lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono. The goal of the framework is to stay out of the way as much as possible and provide a super-duper-happy-path to all interactions.


Nancy is designed to handle DELETEGETHEADOPTIONSPOSTPUT and PATCH requests and provides a simple, elegant, Domain Specific Language (DSL) for returning a response with just a couple of keystrokes, leaving you with more time to focus on the important bits.. your code and your application.

How to Get NancyFx in Visual Studio?


Finding a Package

From the Tools menu, select Library Package Manager and then click Package Manager Console.
Package Manager Console in menu
The Package Manager Console window is displayed.
Package Manager Console
The two drop-down lists set default values that let you omit parameters from the commands you enter in the window:
  • In the Package source list, select the default source (NuGet package feed) that you want your commands to use. Typically you will leave this as its default value ofNuGet official package source. For more information about alternative feeds, see Hosting Your Own NuGet Feeds.
  • In the Default project list, select the default project that you want your commands to work with. (The default value will be the first project in the solution, not necessarily the one you have selected in Solution Explorer when you open the window.)
When you enter commands, you can override these defaults. In the Package Manager Console window, enter Get-Package -ListAvailale at the prompt to see a list of all packages that are available in the selected package source.
Get-Package -ListAvailable command
For the default package source, that command is going to list thousands of packages. It makes better sense to specify a filter.
For example, to find the logging package ELMAH, enter Get-Package -ListAvailable -Filter elmah (the name of the package) or Get-Package -Filter Logging -ListAvailable (a keyword in the package description).
Get-Package command with filter
For more options that you can specify with the Get-Package command, enter Get-Help Get-Package, or see Package Manager Console Powershell Reference.

Installing a Package

After you have found a package that you want to install, use the Install-Package command with the name of the package. For example, enter the command Install-Package Nancy




Creating your first Nancy application


  1. Create a new ASP.NET Empty Web Application
  2. Grab the ASP.NET host for Nancy install-package Nancy.Hosting.Aspnet (this will also install the Nancy nuget and update theweb.config file so that Nancy is made the handler of any request)
  3. Add a Nancy module, which is a standard C# class, and define a route handler for the root URL of the web application, by adding a small amount of code to the constructor:
  4. Compile and run to see the result!
The HelloModule.cs code
public class HelloModule : NancyModule
{
    public HelloModule()
    {
        Get["/"] = parameters => "Hello World";
    }
}
 
Copyright (c) 2010 Asp.net My life and Powered by Blogger.