public static void MapLiteDbEntities(LiteDB.BsonMapper mapper) { mapper.RegisterType <ReleaseDate> ( (date) => date.Serialize(), (bson) => ReleaseDate.Deserialize(bson.AsString) ); mapper.Entity <Game>(). Id(a => a.Id, false). Ignore(a => a.Genres). Ignore(a => a.Developers). Ignore(a => a.Publishers). Ignore(a => a.Tags). Ignore(a => a.Features). Ignore(a => a.Categories). Ignore(a => a.Platforms). Ignore(a => a.Series). Ignore(a => a.AgeRatings). Ignore(a => a.Regions). Ignore(a => a.Source). Ignore(a => a.ReleaseYear). Ignore(a => a.UserScoreRating). Ignore(a => a.CommunityScoreRating). Ignore(a => a.CriticScoreRating). Ignore(a => a.UserScoreGroup). Ignore(a => a.CommunityScoreGroup). Ignore(a => a.CriticScoreGroup). Ignore(a => a.LastActivitySegment). Ignore(a => a.AddedSegment). Ignore(a => a.ModifiedSegment). Ignore(a => a.PlaytimeCategory). Ignore(a => a.IsCustomGame). Ignore(a => a.InstallationStatus); }
public void SerializationTest() { Assert.AreEqual("2001-2-3", new ReleaseDate(2001, 2, 3).Serialize()); Assert.AreEqual("2001-2", new ReleaseDate(2001, 2).Serialize()); Assert.AreEqual("2001", new ReleaseDate(2001).Serialize()); Assert.AreEqual(new ReleaseDate(2001, 2, 3), ReleaseDate.Deserialize("2001-2-3")); Assert.AreEqual(new ReleaseDate(2001, 2), ReleaseDate.Deserialize("2001-2")); Assert.AreEqual(new ReleaseDate(2001), ReleaseDate.Deserialize("2001")); }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var str = value as string; if (str.IsNullOrEmpty()) { return(null); } return(ReleaseDate.Deserialize(str)); }