In most cases INSERT's in OrmLite is as straight forward as passing the POCO you want inserted:
OrmLite provides a couple of different ways to handle Inserting records with AutoIncrementing Ids:
using System.Collections.Generic; | |
using System.Data; | |
using ServiceStack; | |
using ServiceStack.OrmLite; | |
using ServiceStack.DataAnnotations; | |
public class Artist | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } |
using System.Collections.Generic; | |
using System.Data; | |
using ServiceStack; | |
using ServiceStack.OrmLite; | |
using ServiceStack.DataAnnotations; | |
public class Artist | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } |
using System.Collections.Generic; | |
using System.Data; | |
using ServiceStack; | |
using ServiceStack.OrmLite; | |
using ServiceStack.DataAnnotations; | |
public class Artist | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } |
using System.Collections.Generic; | |
using System.Data; | |
using ServiceStack; | |
using ServiceStack.OrmLite; | |
using ServiceStack.DataAnnotations; | |
public class Artist | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } |
using System.Collections.Generic; | |
using System.Data; | |
using ServiceStack; | |
using ServiceStack.OrmLite; | |
using ServiceStack.DataAnnotations; | |
public class Artist | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } |
using System.Collections.Generic; | |
using System.Data; | |
using ServiceStack; | |
using ServiceStack.OrmLite; | |
using ServiceStack.DataAnnotations; | |
public class Artist | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } |
In most cases INSERT's in OrmLite is as straight forward as passing the POCO you want inserted:
OrmLite provides a couple of different ways to handle Inserting records with AutoIncrementing Ids:
OrmLite has extensive support for Querying exposing an intuitive 1:1 Typed API that maps cleanly and has a high affinity with SQL that's not only natural to write but also easy to predict what SQL it generates.
For simple queries you can use terse lambda Expressions to specify the filter conditions you want:
For more advanced queries you can leverage the SqlExpression
builder which provides a Typed API that closely follows
In its most simple form, updating a model on its own without any filter conditions will
update every field, except the Id
which is used to limit the update to itself.
Otherwise you can specify a custom filter condition using a typed expression:
Deleting rows in OrmLite is simple and straight-forward with APIs to support multiple use-cases including deleting by entity, by Id, by lambda expression, by SqlExpression, or Custom SQL expression:
As well as API's for deleting all or multiple rows: