示例#1
0
            public void Initialize(IInitializationControl control)
            {
                if (HttpContext.Current == null)
                {
                    control.NotNow();
                    return;
                }
                _aliasses = new UwebshopAliassesXMLConfig();
                const string path = "/App_Plugins/uWebshop/config/ContentMapping.config";

                if (!System.IO.File.Exists(HttpContext.Current.Server.MapPath(path)))
                {
                    control.Debug("No Aliasses.config");
                }
                else
                {
                    try
                    {
                        _aliasses = DomainHelper.DeserializeXmlStringToObject <UwebshopAliassesXMLConfig>(System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath(path)));
                        Log.Instance.LogDebug("ContentMapping xml loaded");
                        control.Debug("Done loading Aliasses.config");
                    }
                    catch (Exception ex)
                    {
                        Log.Instance.LogError(ex, "ContentMapping xml loading failed");
                        control.FatalError("Failure deserializing " + path);
                        throw;
                    }
                }

                InitNodeAliasses.Initialize(_aliasses);
            }
示例#2
0
        public string GenerateXMLFile()
        {
            var p = new UwebshopAliassesXMLConfig();

            p.Product.ContentTypeAlias = "uwbsProduct";
            p.Product.title            = "titel";
            p.Product.sku = "artikelnr";
            var x = new System.Xml.Serialization.XmlSerializer(p.GetType());

            using (var writer = new StringWriter())
            {
                x.Serialize(writer, p);
                return(writer.ToString());
            }
        }
 public StubContentTypeAliassesXmlService()
 {
     it = new UwebshopAliassesXMLConfig();
     InitNodeAliasses.Initialize(it);
 }