A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/asherber/StaTypPocoQueries.PetaPoco below:

asherber/StaTypPocoQueries.PetaPoco: PetaPoco bindings for StaTypPocoQueries.

PetaPoco bindings for StaTypPocoQueries, allowing you to use some simple, strongly typed, Intellisensed LINQ expressions in your queries.

Database extension methods are provided for Query(), Fetch(), Page(), SkipTake(), Single(), SingleOrDefault(), First(), FirstOrDefault(), and Delete(), essentially letting you use an expression in place of a hand-written WHERE clause. Column names are escaped using the DatabaseProvider for the Database.

Because StaTypPocoQueries.Core includes support for F# quotations, bringing FSharp.Core along for the ride, this library supports those as well.

These examples assume that Database.EnableAutoSelect == true, so that the SELECT (or DELETE) portion of the SQL command is generated for you based on your POCO class. For this reason, the library cannot be used with dynamic.

public class MyClass
{
    public int ID { get; set; }
    public string Name { get; set; }    
}

// Equivalent to db.Query<MyClass>("WHERE [ID] = @0", 4)
db.Query<MyClass>(c => c.ID == 4);

// Equivalent to db.Query<MyClass>("WHERE [ID] > @0", 8)
db.Query<MyClass>(c => c.ID > 8);

// Equivalent to db.Query<MyClass>("WHERE [Name] IS NULL")
db.Query<MyClass>(c => c.Name == null);

// Equivalent to db.Query<MyClass>("WHERE [ID] = @0 OR [ID] = @1", new [] { 1, 2 })
db.Query<MyClass>(c => c.ID == 1 || c.ID == 2);

// Equivalent to db.Query<MyClass>("WHERE [ID] = @0 AND [Name] = @1", new object[] { 10, "Bob" })
db.Query<MyClass>(c => c.ID == 10 && c.Name == "Bob");

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4