/// <summary>
        /// Create a new SponsorType object.
        /// </summary>
        /// <param name="sponsorTypeId">Initial value of the SponsorTypeId property.</param>
        /// <param name="description">Initial value of the Description property.</param>
        public static SponsorType CreateSponsorType(global::System.Int32 sponsorTypeId, global::System.String description)
        {
            SponsorType sponsorType = new SponsorType();

            sponsorType.SponsorTypeId = sponsorTypeId;

            sponsorType.Description = description;

            return(sponsorType);
        }
Beispiel #2
0
        static void RunExample()
        {
            using (var context = new EFRecipesEntities())
            {
                var platst = new SponsorType {
                    Description = "Platinum"
                };
                var goldst = new SponsorType {
                    Description = "Gold"
                };
                var sp1 = new Sponsor {
                    Name = "Rex's Auto Body Shop", SponsorType = goldst
                };
                var sp2 = new Sponsor {
                    Name = "Midtown Eye Care Center", SponsorType = platst
                };
                var sp3 = new Sponsor {
                    Name = "Tri-Cities Ford", SponsorType = platst
                };
                var ev1 = new Event {
                    Name = "OctoberFest", Sponsor = sp1
                };
                var ev2 = new Event {
                    Name = "Concerts in the Park", Sponsor = sp2
                };
                var ev3 = new Event {
                    Name = "11th Street Art Festival", Sponsor = sp3
                };
                context.Events.AddObject(ev1);
                context.Events.AddObject(ev2);
                context.Events.AddObject(ev3);
                context.SaveChanges();
            }

            using (var context = new EFRecipesEntities())
            {
                Console.WriteLine("Events with Platinum Sponsors");
                Console.WriteLine("=============================");
                var esql   = @"select value e from EFRecipesEntities.Events as e 
                             where ref(e.Sponsor) in (EFRecipesModel.PlatinumSponsors())";
                var events = context.CreateQuery <Event>(esql);
                foreach (var ev in events)
                {
                    Console.WriteLine(ev.Name);
                }
            }

            Console.WriteLine("Press <enter> to continue...");
            Console.ReadLine();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the SponsorTypes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSponsorTypes(SponsorType sponsorType)
 {
     base.AddObject("SponsorTypes", sponsorType);
 }