Skip to content

Instantly share code, notes, and snippets.

@Vaccano
Created December 23, 2016 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vaccano/c8ed812c807b0314c0cd41ac4f78f393 to your computer and use it in GitHub Desktop.
Save Vaccano/c8ed812c807b0314c0cd41ac4f78f393 to your computer and use it in GitHub Desktop.
Origin And State Entities
namespace DataAccessLayer
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
[Table("template.Origin")]
public partial class Origin
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Origin()
{
Shipments = new HashSet<Shipment>();
}
public int OriginId { get; set; }
[Required]
[StringLength(10)]
public string Code { get; set; }
[Required]
[StringLength(100)]
public string Name { get; set; }
[Required]
[StringLength(100)]
public string City { get; set; }
public int StateId { get; set; }
public virtual State State { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Shipment> Shipments { get; set; }
}
}
namespace DataAccessLayer
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
[Table("template.State")]
public partial class State
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public State()
{
// Origins = new HashSet<Origin>();
}
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int StateId { get; set; }
[Required]
[StringLength(2)]
public string Abbreviation { get; set; }
[Required]
[StringLength(50)]
public string Name { get; set; }
//[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
//public virtual ICollection<Origin> Origins { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment