/// <summary> /// This should be called after any postback and/or before any save. due to how we can delete mid-row /// in the UI, properties are only soft-deleted and need to be physically removed here. /// </summary> public void CleanDeletedAndEmptyProperties() { StringStats?.RemoveAll(x => x == null || x.Deleted || string.IsNullOrEmpty(x.Value)); IntStats?.RemoveAll(x => x == null || x.Deleted); Int64Stats?.RemoveAll(x => x == null || x.Deleted); FloatStats?.RemoveAll(x => x == null || x.Deleted); BoolStats?.RemoveAll(x => x == null || x.Deleted); DidStats?.RemoveAll(x => x == null || x.Deleted); Spells?.RemoveAll(x => x == null || x.Deleted); Book?.Pages?.RemoveAll(x => x == null || x.Deleted); Positions?.RemoveAll(x => x == null || x.Deleted); EmoteTable?.ForEach(es => es?.Emotes?.ForEach(esa => esa?.Actions?.RemoveAll(x => x == null || x.Deleted))); EmoteTable?.ForEach(es => es?.Emotes?.RemoveAll(x => x == null || x.Deleted)); EmoteTable?.RemoveAll(x => x == null || x.Deleted || x.Emotes?.Count < 1); Body?.BodyParts?.RemoveAll(x => x == null || x.Deleted); GeneratorTable?.RemoveAll(x => x == null || x.Deleted); CreateList?.RemoveAll(x => x == null || x.Deleted); Skills?.RemoveAll(x => x == null || x.Deleted); // this property's existence causes all sorts of problems. needs to go away. IntStats?.RemoveAll(x => x.Key == 9007); if (!HasAbilities) { Attributes = null; } }
/// <summary> /// This should be called after any postback and/or before any save. due to how we can delete mid-row /// in the UI, properties are only soft-deleted and need to be physically removed here. /// </summary> public void CleanDeletedAndEmptyProperties() { StringProperties?.RemoveAll(x => x == null || x.Deleted || x.Value == null); IntProperties?.RemoveAll(x => x == null || x.Deleted || x.Value == null); Int64Properties?.RemoveAll(x => x == null || x.Deleted || x.Value == null); DoubleProperties?.RemoveAll(x => x == null || x.Deleted || x.Value == null); BoolProperties?.RemoveAll(x => x == null || x.Deleted); DidProperties?.RemoveAll(x => x == null || x.Deleted || x.Value == null); IidProperties?.RemoveAll(x => x == null || x.Deleted || x.Value == null); Spells?.RemoveAll(x => x == null || x.Deleted); BookProperties?.RemoveAll(x => x == null || x.Deleted); Positions?.RemoveAll(x => x == null || x.Deleted); EmoteTable.ForEach(es => es.Emotes.RemoveAll(x => x == null || x.Deleted)); EmoteTable?.RemoveAll(x => x == null || x.Deleted); BodyParts?.RemoveAll(x => x == null || x.Deleted); GeneratorTable?.RemoveAll(x => x == null || x.Deleted); CreateList?.RemoveAll(x => x == null || x.Deleted); Skills.RemoveAll(x => x == null || x.Deleted); if (!HasAbilities) { Abilities = null; } }