private static bool HasIdChanged(M modl) { if (!Definitions.HasAutomaticId && Definitions.HasIdProperty) { var id = Definitions.IdProperty.GetValue(modl); return(IdConverter.HasValue(id) && modl.Modl.Id != id); } else { return(false); } }
private static Identity GetId(M modl) { if (!Definitions.HasAutomaticId && Definitions.HasIdProperty) { var id = Definitions.IdProperty.GetValue(modl); if (IdConverter.HasValue(id)) { return(Identity.FromId(id, Definitions)); } } return(Identity.GenerateNewId(Definitions)); }
internal void ChangeId(Identity newId) { if (!Backer.IsNew) { throw new InvalidIdException("Can't change id of a Modl that is not new"); } if (!IdConverter.HasValue(newId.Get())) { throw new InvalidIdException("Can't change to an empty id"); } this.Id = newId; WriteNewModlDataToAllInstances(); WriteIdToAllInstances(); }