//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Data.EntityClient;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;
[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata
[assembly: EdmRelationshipAttribute("MvcBasicSiteModel", "FK_Addresses_Countries", "Countries", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(MvcBasic.Logic.Country), "Addresses", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(MvcBasic.Logic.Address), true)]
[assembly: EdmRelationshipAttribute("MvcBasicSiteModel", "FK_Users_Addresses", "Addresses", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(MvcBasic.Logic.Address), "Users", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(MvcBasic.Logic.User), true)]
#endregion
namespace MvcBasic.Logic
{
#region Contexts
/// <summary>
/// No Metadata Documentation available.
/// </summary>
public partial class MvcBasicSiteEntities : ObjectContext
{
#region Constructors
/// <summary>
/// Initializes a new MvcBasicSiteEntities object using the connection string found in the 'MvcBasicSiteEntities' section of the application configuration file.
/// </summary>
public MvcBasicSiteEntities() : base("name=MvcBasicSiteEntities", "MvcBasicSiteEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
/// <summary>
/// Initialize a new MvcBasicSiteEntities object.
/// </summary>
public MvcBasicSiteEntities(string connectionString) : base(connectionString, "MvcBasicSiteEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
/// <summary>
/// Initialize a new MvcBasicSiteEntities object.
/// </summary>
public MvcBasicSiteEntities(EntityConnection connection) : base(connection, "MvcBasicSiteEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
#endregion
#region Partial Methods
partial void OnContextCreated();
#endregion
#region ObjectSet Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
public ObjectSet<Address> Addresses
{
get
{
if ((_Addresses == null))
{
_Addresses = base.CreateObjectSet<Address>("Addresses");
}
return _Addresses;
}
}
private ObjectSet<Address> _Addresses;
/// <summary>
/// No Metadata Documentation available.
/// </summary>
public ObjectSet<Country> Countries
{
get
{
if ((_Countries == null))
{
_Countries = base.CreateObjectSet<Country>("Countries");
}
return _Countries;
}
}
private ObjectSet<Country> _Countries;
/// <summary>
/// No Metadata Documentation available.
/// </summary>
public ObjectSet<User> Users
{
get
{
if ((_Users == null))
{
_Users = base.CreateObjectSet<User>("Users");
}
return _Users;
}
}
private ObjectSet<User> _Users;
#endregion
#region AddTo Methods
/// <summary>
/// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead.
/// </summary>
public void AddToAddresses(Address address)
{
base.AddObject("Addresses", address);
}
/// <summary>
/// Deprecated Method for adding a new object to the Countries EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead.
/// </summary>
public void AddToCountries(Country country)
{
base.AddObject("Countries", country);
}
/// <summary>
/// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead.
/// </summary>
public void AddToUsers(User user)
{
base.AddObject("Users", user);
}
#endregion
}
#endregion
#region Entities
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmEntityTypeAttribute(NamespaceName="MvcBasicSiteModel", Name="Address")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class Address : EntityObject
{
#region Factory Method
/// <summary>
/// Create a new Address object.
/// </summary>
/// <param name="id">Initial value of the ID property.</param>
/// <param name="firstName">Initial value of the FirstName property.</param>
/// <param name="lastName">Initial value of the LastName property.</param>
/// <param name="street">Initial value of the Street property.</param>
/// <param name="town">Initial value of the Town property.</param>
/// <param name="zipCode">Initial value of the ZipCode property.</param>
public static Address CreateAddress(global::System.Int32 id, global::System.String firstName, global::System.String lastName, global::System.String street, global::System.String town, global::System.String zipCode)
{
Address address = new Address();
address.ID = id;
address.FirstName = firstName;
address.LastName = lastName;
address.Street = street;
address.Town = town;
address.ZipCode = zipCode;
return address;
}
#endregion
#region Primitive Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[DataMemberAttribute()]
public global::System.Int32 ID
{
get
{
return _ID;
}
set
{
if (_ID != value)
{
OnIDChanging(value);
ReportPropertyChanging("ID");
_ID = StructuralObject.SetValidValue(value);
ReportPropertyChanged("ID");
OnIDChanged();
}
}
}
private global::System.Int32 _ID;
partial void OnIDChanging(global::System.Int32 value);
partial void OnIDChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String FirstName
{
get
{
return _FirstName;
}
set
{
OnFirstNameChanging(value);
ReportPropertyChanging("FirstName");
_FirstName = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("FirstName");
OnFirstNameChanged();
}
}
private global::System.String _FirstName;
partial void OnFirstNameChanging(global::System.String value);
partial void OnFirstNameChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String LastName
{
get
{
return _LastName;
}
set
{
OnLastNameChanging(value);
ReportPropertyChanging("LastName");
_LastName = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("LastName");
OnLastNameChanged();
}
}
private global::System.String _LastName;
partial void OnLastNameChanging(global::System.String value);
partial void OnLastNameChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Street
{
get
{
return _Street;
}
set
{
OnStreetChanging(value);
ReportPropertyChanging("Street");
_Street = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("Street");
OnStreetChanged();
}
}
private global::System.String _Street;
partial void OnStreetChanging(global::System.String value);
partial void OnStreetChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Town
{
get
{
return _Town;
}
set
{
OnTownChanging(value);
ReportPropertyChanging("Town");
_Town = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("Town");
OnTownChanged();
}
}
private global::System.String _Town;
partial void OnTownChanging(global::System.String value);
partial void OnTownChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String ZipCode
{
get
{
return _ZipCode;
}
set
{
OnZipCodeChanging(value);
ReportPropertyChanging("ZipCode");
_ZipCode = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("ZipCode");
OnZipCodeChanged();
}
}
private global::System.String _ZipCode;
partial void OnZipCodeChanging(global::System.String value);
partial void OnZipCodeChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
[DataMemberAttribute()]
public global::System.String Phone
{
get
{
return _Phone;
}
set
{
OnPhoneChanging(value);
ReportPropertyChanging("Phone");
_Phone = StructuralObject.SetValidValue(value, true);
ReportPropertyChanged("Phone");
OnPhoneChanged();
}
}
private global::System.String _Phone;
partial void OnPhoneChanging(global::System.String value);
partial void OnPhoneChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
[DataMemberAttribute()]
public global::System.String Fax
{
get
{
return _Fax;
}
set
{
OnFaxChanging(value);
ReportPropertyChanging("Fax");
_Fax = StructuralObject.SetValidValue(value, true);
ReportPropertyChanged("Fax");
OnFaxChanged();
}
}
private global::System.String _Fax;
partial void OnFaxChanging(global::System.String value);
partial void OnFaxChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
[DataMemberAttribute()]
public Nullable<global::System.Int32> CountryID
{
get
{
return _CountryID;
}
set
{
OnCountryIDChanging(value);
ReportPropertyChanging("CountryID");
_CountryID = StructuralObject.SetValidValue(value);
ReportPropertyChanged("CountryID");
OnCountryIDChanged();
}
}
private Nullable<global::System.Int32> _CountryID;
partial void OnCountryIDChanging(Nullable<global::System.Int32> value);
partial void OnCountryIDChanged();
#endregion
#region Navigation Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("MvcBasicSiteModel", "FK_Addresses_Countries", "Countries")]
public Country Country
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Country>("MvcBasicSiteModel.FK_Addresses_Countries", "Countries").Value;
}
set
{
((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Country>("MvcBasicSiteModel.FK_Addresses_Countries", "Countries").Value = value;
}
}
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[BrowsableAttribute(false)]
[DataMemberAttribute()]
public EntityReference<Country> CountryReference
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Country>("MvcBasicSiteModel.FK_Addresses_Countries", "Countries");
}
set
{
if ((value != null))
{
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Country>("MvcBasicSiteModel.FK_Addresses_Countries", "Countries", value);
}
}
}
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("MvcBasicSiteModel", "FK_Users_Addresses", "Users")]
public EntityCollection<User> Users
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<User>("MvcBasicSiteModel.FK_Users_Addresses", "Users");
}
set
{
if ((value != null))
{
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<User>("MvcBasicSiteModel.FK_Users_Addresses", "Users", value);
}
}
}
#endregion
}
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmEntityTypeAttribute(NamespaceName="MvcBasicSiteModel", Name="Country")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class Country : EntityObject
{
#region Factory Method
/// <summary>
/// Create a new Country object.
/// </summary>
/// <param name="id">Initial value of the ID property.</param>
/// <param name="name">Initial value of the Name property.</param>
public static Country CreateCountry(global::System.Int32 id, global::System.String name)
{
Country country = new Country();
country.ID = id;
country.Name = name;
return country;
}
#endregion
#region Primitive Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[DataMemberAttribute()]
public global::System.Int32 ID
{
get
{
return _ID;
}
set
{
if (_ID != value)
{
OnIDChanging(value);
ReportPropertyChanging("ID");
_ID = StructuralObject.SetValidValue(value);
ReportPropertyChanged("ID");
OnIDChanged();
}
}
}
private global::System.Int32 _ID;
partial void OnIDChanging(global::System.Int32 value);
partial void OnIDChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Name
{
get
{
return _Name;
}
set
{
OnNameChanging(value);
ReportPropertyChanging("Name");
_Name = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("Name");
OnNameChanged();
}
}
private global::System.String _Name;
partial void OnNameChanging(global::System.String value);
partial void OnNameChanged();
#endregion
#region Navigation Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("MvcBasicSiteModel", "FK_Addresses_Countries", "Addresses")]
public EntityCollection<Address> Addresses
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Address>("MvcBasicSiteModel.FK_Addresses_Countries", "Addresses");
}
set
{
if ((value != null))
{
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Address>("MvcBasicSiteModel.FK_Addresses_Countries", "Addresses", value);
}
}
}
#endregion
}
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmEntityTypeAttribute(NamespaceName="MvcBasicSiteModel", Name="User")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class User : EntityObject
{
#region Factory Method
/// <summary>
/// Create a new User object.
/// </summary>
/// <param name="id">Initial value of the ID property.</param>
/// <param name="username">Initial value of the Username property.</param>
/// <param name="password">Initial value of the Password property.</param>
/// <param name="email">Initial value of the Email property.</param>
/// <param name="role">Initial value of the Role property.</param>
public static User CreateUser(global::System.Int32 id, global::System.String username, global::System.String password, global::System.String email, global::System.Int32 role)
{
User user = new User();
user.ID = id;
user.Username = username;
user.Password = password;
user.Email = email;
user.Role = role;
return user;
}
#endregion
#region Primitive Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[DataMemberAttribute()]
public global::System.Int32 ID
{
get
{
return _ID;
}
set
{
if (_ID != value)
{
OnIDChanging(value);
ReportPropertyChanging("ID");
_ID = StructuralObject.SetValidValue(value);
ReportPropertyChanged("ID");
OnIDChanged();
}
}
}
private global::System.Int32 _ID;
partial void OnIDChanging(global::System.Int32 value);
partial void OnIDChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Username
{
get
{
return _Username;
}
set
{
OnUsernameChanging(value);
ReportPropertyChanging("Username");
_Username = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("Username");
OnUsernameChanged();
}
}
private global::System.String _Username;
partial void OnUsernameChanging(global::System.String value);
partial void OnUsernameChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Password
{
get
{
return _Password;
}
set
{
OnPasswordChanging(value);
ReportPropertyChanging("Password");
_Password = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("Password");
OnPasswordChanged();
}
}
private global::System.String _Password;
partial void OnPasswordChanging(global::System.String value);
partial void OnPasswordChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.String Email
{
get
{
return _Email;
}
set
{
OnEmailChanging(value);
ReportPropertyChanging("Email");
_Email = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("Email");
OnEmailChanged();
}
}
private global::System.String _Email;
partial void OnEmailChanging(global::System.String value);
partial void OnEmailChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[DataMemberAttribute()]
public global::System.Int32 Role
{
get
{
return _Role;
}
set
{
OnRoleChanging(value);
ReportPropertyChanging("Role");
_Role = StructuralObject.SetValidValue(value);
ReportPropertyChanged("Role");
OnRoleChanged();
}
}
private global::System.Int32 _Role;
partial void OnRoleChanging(global::System.Int32 value);
partial void OnRoleChanged();
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
[DataMemberAttribute()]
public Nullable<global::System.Int32> AddressID
{
get
{
return _AddressID;
}
set
{
OnAddressIDChanging(value);
ReportPropertyChanging("AddressID");
_AddressID = StructuralObject.SetValidValue(value);
ReportPropertyChanged("AddressID");
OnAddressIDChanged();
}
}
private Nullable<global::System.Int32> _AddressID;
partial void OnAddressIDChanging(Nullable<global::System.Int32> value);
partial void OnAddressIDChanged();
#endregion
#region Navigation Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("MvcBasicSiteModel", "FK_Users_Addresses", "Addresses")]
public Address Address
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Address>("MvcBasicSiteModel.FK_Users_Addresses", "Addresses").Value;
}
set
{
((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Address>("MvcBasicSiteModel.FK_Users_Addresses", "Addresses").Value = value;
}
}
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[BrowsableAttribute(false)]
[DataMemberAttribute()]
public EntityReference<Address> AddressReference
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Address>("MvcBasicSiteModel.FK_Users_Addresses", "Addresses");
}
set
{
if ((value != null))
{
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Address>("MvcBasicSiteModel.FK_Users_Addresses", "Addresses", value);
}
}
}
#endregion
}
#endregion
}