Esempio n. 1
0
 /// <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;
 }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the CountryAliases EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCountryAliases(CountryAlias countryAlias)
 {
     base.AddObject("CountryAliases", countryAlias);
 }