View on GitHub

SauceDB

.net ORM with multipe database engine support.

Download this project as a .zip file Download this project as a tar.gz file

Primary Keys

Sauce will assume that there is only one primary key and its name is ID
This can be changed on a per object basis
You can also use this technique to specify more than one.

Two Primary Keys

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess.Core.Attributes;

namespace SauceExample
{
  public class MyObject
  {
    [Key]
    public int keyOne { get; set; }

    [Key]
    public int keyTwo { get; set; }
    
    public string Name { get; set; }
  }
}

Two Primary Keys (one specified one inferred)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess.Core.Attributes;

namespace SauceExample
{
  public class MyObject
  {
    public int id { get; set; } //this is a primary key

    [Key]
    public int keyTwo { get; set; } //this is a primary key too
    
    public string Name { get; set; }
  }
}

One Primary Keys

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess.Core.Attributes;

namespace SauceExample
{
  public class MyObject
  {
    [Key]
    public int key { get; set; }
    
    public string Name { get; set; }
  }
}