public virtual void StartEditPackageRequest(Package p, EditPackageVersionRequest request, User editingUser) { if (PackageNamingConflictValidator.TitleConflictsWithExistingRegistrationId(p.PackageRegistration.Id, request.VersionTitle)) { throw new EntityException(Strings.TitleMatchesExistingRegistration, request.VersionTitle); } PackageEdit edit = new PackageEdit { // Description User = editingUser, Authors = request.Authors, Copyright = request.Copyright, Description = request.Description, IconUrl = request.IconUrl, LicenseUrl = p.LicenseUrl, // Our current policy is not to allow editing the license URL, so just clone it from its previous value. ProjectUrl = request.ProjectUrl, ReleaseNotes = request.ReleaseNotes, RequiresLicenseAcceptance = request.RequiresLicenseAcceptance, Summary = request.Summary, Tags = request.Tags, Title = request.VersionTitle, // Other Package = p, Timestamp = DateTime.UtcNow, TriedCount = 0, }; EntitiesContext.Set <PackageEdit>().Add(edit); // Note: EditPackageRequests are completed asynchronously by the worker role. }
/// <summary> /// Returns the newest, uncompleted metadata for a package (i.e. a pending edit) /// </summary> public virtual PackageEdit GetPendingMetadata(Package p) { return(EntitiesContext.Set <PackageEdit>() .Where(m => m.PackageKey == p.Key) .OrderByDescending(m => m.Timestamp) .FirstOrDefault()); }
DbSet <T> IReadOnlyEntitiesContext.Set <T>() { return(_entitiesContext.Set <T>()); }
public void DeleteOnCommit(T entity) { entities.Set <T>() .Remove(entity); }