public void TestStoreMultipleLangs() { CreateTwoLangProduct(); using (var session = SessionFactory.Create()) { var product = session.AsQueryable <TProduct>().SingleOrDefault(p => p.Code == ProductCode); var multLangName = new MultiCulturalString(ru, ProductNameRu) .SetLocalizedString(en, ProductNameEn); Assert.IsNotNull(product); Assert.AreEqual(multLangName, product.Name); } }
private string ConvertToStoredValue(MultiCulturalString typedValue) { using (Stream stream = new MemoryStream()) { IFormatter formatter = new XmlFormatter(typeof(MultiCulturalString), "http://custis.ru/i18n"); formatter.Serialize(stream, typedValue); stream.Flush(); stream.Position = 0; using (TextReader reader = new StreamReader(stream)) { return(reader.ReadToEnd()); } } }