private Sector CreateSector( string name, params string[] aliases ) { var sector = new Sector() { Name = name }; foreach ( var alias in aliases ) { sector.Aliases.Add( new SectorAlias() { Sector = sector, Name = alias } ); } return sector; }
/// <summary> /// Adds this company to the given sector if it has not been added /// already. Also checks sector aliases of all sectors the company /// is already added to. /// </summary> public void AddToSectorIfNew( Sector sector ) { if ( Sectors.FirstOrDefault( s => s.Name == sector.Name ) != null ) { return; } if ( Sectors.SelectMany( s => s.Aliases ).FirstOrDefault( a => a.Name == sector.Name ) != null ) { return; } Sectors.Add( sector ); }
/// <summary> /// Deprecated Method for adding a new object to the Sectors EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSectors(Sector sector) { base.AddObject("Sectors", sector); }
/// <summary> /// Create a new Sector object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> public static Sector CreateSector(global::System.Int64 id, global::System.String name) { Sector sector = new Sector(); sector.Id = id; sector.Name = name; return sector; }