private void RemoveGeneratedAPIs(API.APIType apiType) { using (new Wait()) { foreach (TableMapping tm in ProjectContext.Project.TableMappings) { List <API> apisToRemove = new List <API>(); foreach (API api in new List <API>(tm.APIs)) { tm.APIs.Remove(api); } } } }
private void AddGeneratedAPIs(API.APIType apiType) { foreach (TableMapping tm in ProjectContext.Project.TableMappings.Where(o => !o.Exclude && !o.APIs.Any(a => a.Type == apiType))) { API api = (apiType == API.APIType.Create ? API.CreateValueTypeCreateAPI(tm) : API.CreateDeleteAPI(tm)); api.Attributes.Add(new Attribute <API>(ATTRIBUTE_AUTOGEN, null)); tm.APIs.Add(api); if (apiType == API.APIType.Create && tm.ContainingProject.ForeignKeyMappings.Any(fkm => fkm.ParentTableMapping == tm)) { api = API.CreateObjectCreateAPI(tm); api.Attributes.Add(new Attribute <API>(ATTRIBUTE_AUTOGEN, null)); tm.APIs.Add(api); } MarkAsUnsaved(); } }