Two Explicit 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; }
  }
}

One Implied Key, One Explicit Key
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 Explicit Key

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; }
  }
}

Last edited May 30, 2013 at 3:14 AM by iamkrillin, version 8

Comments

No comments yet.