コード例 #1
0
        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);
            }
        }
コード例 #2
0
 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());
         }
     }
 }