/// <summary> /// Configures the specified property info. /// </summary> /// <param name="propertyInfo">The property info.</param> /// <param name="config">The config.</param> public void Configure(PropertyInfo propertyInfo, ParentConfiguration config) { config.IsLazy = IsLazy; config.InferType = InferType; base.Configure(propertyInfo, config); }
public UmbracoRepository(IUmbracoServiceProvider umbracoServiceProvider) { _umbracoServiceProvider = umbracoServiceProvider; var classInfo = _umbracoServiceProvider.GetUmbracoService().GlassContext[typeof(T)]; _parentProperty = classInfo.Properties.OfType <ParentConfiguration>().FirstOrDefault(); }
/// <summary> /// Configures the specified property info. /// </summary> /// <param name="propertyInfo">The property info.</param> /// <param name="config">The config.</param> public void Configure(PropertyInfo propertyInfo, ParentConfiguration config) { config.IsLazy = IsLazy; config.InferType = InferType; base.Configure(propertyInfo, config); }
public void Configure_IsLazyByDefault_IsLazyConfigTrue() { //Assign var attr = new StubParentAttribute(); var config = new ParentConfiguration(); var propertyInfo = typeof(StubItem).GetProperty("X"); //Act attr.Configure(propertyInfo, config); //Assert Assert.AreEqual(propertyInfo, config.PropertyInfo); Assert.IsTrue(config.IsLazy); Assert.IsFalse(config.InferType); }
public void Configure_InferTypeSet_InferTypeSetOnConfig() { //Assign var attr = new StubParentAttribute(); var config = new ParentConfiguration(); var propertyInfo = typeof(StubItem).GetProperty("X"); attr.InferType = true; //Act attr.Configure(propertyInfo, config); //Assert Assert.AreEqual(propertyInfo, config.PropertyInfo); Assert.IsTrue(config.InferType); }
public SitecoreRepository(IDatabaseProvider dbProvider, ISitecoreServiceProvider sitecoreServiceProvider, IProviderSearchContextProvider searchContextProvider, ILogger logger) { _dbProvider = dbProvider; _sitecoreServiceProvider = sitecoreServiceProvider; _searchContextProvider = searchContextProvider; _logger = logger; var classInfo = _sitecoreServiceProvider.GetSitecoreService().GlassContext[typeof(T)]; _parentProperty = classInfo.Properties.OfType <ParentConfiguration>().FirstOrDefault(); _pathProperty = classInfo.Properties.OfType <SitecoreInfoConfiguration>().FirstOrDefault(p => p.Type == SitecoreInfoType.FullPath || p.Type == SitecoreInfoType.Path); _nameProperty = classInfo.Properties.OfType <SitecoreInfoConfiguration>().FirstOrDefault(p => p.Type == SitecoreInfoType.Name); }
public void Configure_InferTypeSet_InferTypeSetOnConfig() { //Assign var attr = new StubParentAttribute(); var config = new ParentConfiguration(); var propertyInfo = Substitute.For <PropertyInfo>(); attr.InferType = true; //Act attr.Configure(propertyInfo, config); //Assert Assert.AreEqual(propertyInfo, config.PropertyInfo); Assert.IsTrue(config.IsLazy); Assert.IsTrue(config.InferType); }
public void Configure_IsLazySetToFalse_IsLazyConfigFalse() { //Assign var attr = new StubParentAttribute(); var config = new ParentConfiguration(); var propertyInfo = Substitute.For <PropertyInfo>(); attr.IsLazy = false; //Act attr.Configure(propertyInfo, config); //Assert Assert.AreEqual(propertyInfo, config.PropertyInfo); Assert.IsFalse(config.IsLazy); Assert.IsFalse(config.InferType); }