internal static int GetApplicationID(this Entities data, string ApplicationName) { var myApp = data.Applications.FirstOrDefault(app => app.Name == ApplicationName); if (myApp == null) { myApp = new Application() { Name = ApplicationName }; data.AddToApplications(myApp); data.SaveChanges(); } return myApp.ApplicationID; }
/// <summary> /// Create a new Application object. /// </summary> /// <param name="applicationID">Initial value of the ApplicationID property.</param> /// <param name="name">Initial value of the Name property.</param> public static Application CreateApplication(global::System.Int32 applicationID, global::System.String name) { Application application = new Application(); application.ApplicationID = applicationID; application.Name = name; return application; }
/// <summary> /// Deprecated Method for adding a new object to the Applications EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToApplications(Application application) { base.AddObject("Applications", application); }