/// <summary> /// Create a new CountryAlias object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> public static CountryAlias CreateCountryAlias(global::System.Int64 id, global::System.String name) { CountryAlias countryAlias = new CountryAlias(); countryAlias.Id = id; countryAlias.Name = name; return countryAlias; }
private void ImportCountriesWithAliases() { using ( var trans = new TransactionScope() ) { using ( var tom = Engine.ServiceProvider.CreateEntityRepository() ) { foreach ( var record in CountryAliasRecords ) { var lcid = record.Item1; var alias = record.Item2; var country = tom.Countries.FirstOrDefault( c => c.LCID == lcid ); if ( country == null ) { country = new Country( lcid ); tom.Countries.AddObject( country ); } if ( !tom.CountryAliases.Any( a => a.Name == alias ) ) { var countryAlias = new CountryAlias( country, alias ); tom.CountryAliases.AddObject( countryAlias ); } } tom.SaveChanges(); } trans.Complete(); } }
/// <summary> /// Deprecated Method for adding a new object to the CountryAliases EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCountryAliases(CountryAlias countryAlias) { base.AddObject("CountryAliases", countryAlias); }