コード例 #1
0
        public static IConfigurationLoader[] GlassLoaders()
        {
            var web  = new SitecoreAttributeConfigurationLoader("Autohaus.Web");
            var data = new SitecoreAttributeConfigurationLoader("Autohaus.Data");

            return(new IConfigurationLoader[] { web, data });
        }
コード例 #2
0
        public static void Start()
        {
            //create config
            var config = new Config();

            //create the resolver
            var resolver = DependencyResolver.CreateStandardResolver();

            resolver.Container.Install(new SitecoreInstaller(config));

            //create a context
            var context = Glass.Mapper.Context.Create(resolver, GlassRazorSettings.ContextName);

            var loader = new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Razor");

            context.Load(
                loader
                );
        }
コード例 #3
0
        public void Load_StubClassConfigured_ReturnsStubClassAndProperties()
        {
            //Assign
            var loader = new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Tests");

            //Act
            var results = loader.Load();

            //Assert
            Assert.GreaterOrEqual(results.Count(), 0);

            var typeConfig = results.First(x => x.Type == typeof(StubClass));

            Assert.IsNotNull(typeConfig);

            var propertyNames = new[] { "Children", "Field", "Id", "Info", "Linked", "Node", "Parent", "Query" };

            foreach (var propertyName in propertyNames)
            {
                var propInfo = typeof(StubClass).GetProperty(propertyName);
                Assert.IsTrue(typeConfig.Properties.Any(x => x.PropertyInfo == propInfo));
            }
        }
コード例 #4
0
        public static void Start()
        {
            var config = new Config();

            config.UseWindsorContructor = true;

            //create the resolver
            var resolver = DependencyResolver.CreateStandardResolver(config);

            //install the custom services
            var container = (resolver as DependencyResolver).Container;

            container.Install(new ServiceInstaller());

            //create a context
            var context = Glass.Mapper.Context.Create(resolver);

            var attributes = new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sites.Sc");

            context.Load(
                attributes,
                Models.Config.ContentConfig.Load()
                );
        }
コード例 #5
0
        public static IConfigurationLoader[] GlassLoaders()
        {
            var attributes = new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sites.Sc");

            return(new IConfigurationLoader[] { attributes, Models.Config.ContentConfig.Load() });
        }
コード例 #6
0
        public void BasicTemplate_LoadedByAttributeLoader()
        {
            //Assign
            var loader = new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Upgrade.Tests");


            //Act
            var configs = loader.Load();

            //Assert
            var basicTemplate = configs.First(x => x.Type == typeof(BasicTemplate));
            var subClass      = configs.First(x => x.Type == typeof(SubClass));

            Assert.IsNotNull(basicTemplate);
            Assert.IsNotNull(subClass);

            #region SitecoreId

            CheckProperty(basicTemplate, "Id", typeof(SitecoreIdConfiguration));

            #endregion
            #region Fields
            #region Simple Types

            CheckProperty(basicTemplate, "Checkbox", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Date", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "DateTime", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "File", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Image", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Integer", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Float", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Double", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Decimal", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "MultiLineText", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Number", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Password", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "RichText", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "SingleLineText", typeof(SitecoreFieldConfiguration));

            #endregion
            #region List Types

            CheckProperty(basicTemplate, "CheckList", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "DropList", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "GroupedDropLink", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "GroupedDropList", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "MultiList", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "Treelist", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "TreeListEx", typeof(SitecoreFieldConfiguration));

            #endregion
            #region Link Types

            CheckProperty(basicTemplate, "DropLink", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "DropTree", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "GeneralLink", typeof(SitecoreFieldConfiguration));

            #endregion
            #region Developer Types

            CheckProperty(basicTemplate, "Icon", typeof(SitecoreFieldConfiguration));
            CheckProperty(basicTemplate, "TriState", typeof(SitecoreFieldConfiguration));

            #endregion
            #region SystemType

            CheckProperty(basicTemplate, "Attachment", typeof(SitecoreFieldConfiguration));

            #endregion
            #endregion

            #region SitecoreInfo

            CheckProperty(basicTemplate, "ContentPath", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "DisplayName", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "FullPath", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "Key", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "MediaUrl", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "Path", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "TemplateId", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "TemplateName", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "Url", typeof(SitecoreInfoConfiguration));
            CheckProperty(basicTemplate, "Version", typeof(SitecoreInfoConfiguration));

            #endregion

            #region SitecoreChildren

            CheckProperty(basicTemplate, "Children", typeof(SitecoreChildrenConfiguration));

            #endregion

            #region SitecoreParent

            CheckProperty(basicTemplate, "Parent", typeof(SitecoreParentConfiguration));

            #endregion

            #region SitecoreQuery

            CheckProperty(basicTemplate, "Query", typeof(SitecoreQueryConfiguration));

            #endregion
        }