Skip to content

Instantly share code, notes, and snippets.

@PaulDuffy3
Created August 9, 2016 02:21
Show Gist options
  • Save PaulDuffy3/b5ae384217f9f5a45609480337a6aa6a to your computer and use it in GitHub Desktop.
Save PaulDuffy3/b5ae384217f9f5a45609480337a6aa6a to your computer and use it in GitHub Desktop.
ASP.Net Core 1 NPOCO Sample Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NPoco;
namespace NPOCOTestProject.Models
{
[TableName("ADDR_Address")]
[PrimaryKey("ADDR_ID")]
public class Address
{
public int ADDR_ID { get; set; }
public int ADDR_FK_USER_ID { get; set; }
public string ADDR_AddressType { get; set; }
public string ADDR_StreetAddress { get; set; }
public string ADDR_City { get; set; }
public Int16 ADDR_FK_STTE_ID { get; set; }
public string ADDR_PostalCode { get; set; }
[Ignore]
internal bool IsNew
{
get
{
return this.ADDR_ID == default(int);
}
}
[Ignore]
public bool IsDeleted { get; set; }
}
}
using System;
using System.Collections.Generic;
using NPoco;
namespace NPOCOTestProject.Models
{
[TableName("USER_User")]
[PrimaryKey("USER_ID")]
public class User
{
public User()
{
this.Addresses = new List<Address>();
}
public int USER_ID { get; set; }
public DateTime USER_DateCreated { get; set; }
public DateTime USER_DateModified { get; set; }
public Int16 USER_FK_USST_ID { get; set; }
public Int16 USER_FK_USTY_ID { get; set; }
public string USER_FirstName { get; set; }
public string USER_LastName { get; set; }
public string USER_EmailAddress { get; set; }
public string USER_Password { get; set; }
[Ignore]
public List<Address> Addresses { get; set; }
[Ignore]
internal bool IsNew
{
get
{
return this.USER_ID == default(int);
}
}
[Ignore]
public bool IsDeleted { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment