private static void SaveItem <TEntity>(Item item, Map <TEntity> map, TEntity entity) where TEntity : ISitecoreDomainEntity { item.Editing.BeginEdit(); DomainEntityPropertyResolver.ResolveItem(item, map, entity); item.Editing.EndEdit(); }
private TEntity SaveItem <TEntity>(Item item, Map <TEntity> map, TEntity entity) where TEntity : ISitecoreDomainEntity { item.Editing.BeginEdit(); DomainEntityPropertyResolver.ResolveItem(item, map, entity); item.Editing.EndEdit(); return((TEntity)m_resolver.ResolveEntity(item, map)); }
public static void UpdateProperty <TEntity, TProperty>(TEntity entity, Expression <Func <TEntity, TProperty> > propertyExpression) where TEntity : ISitecoreDomainEntity { Guard.ParameterNotNull(entity); Guard.ParameterNotNull(propertyExpression); IMap entityMap = MapFinder.FindMap <TEntity>() as IMap; string propertyName = propertyExpression.GetPropertyName(); Logger.LogDebugMessage(String.Format("Updating property '{0}' of '{1}' for item {2}", propertyName, typeof(TEntity), entity.Id)); MapEntry mapEntry = entityMap.Mappings.First(mapping => mapping.MappedProperty.Name == propertyName); using (new SecurityDisabler()) { Item item = GetItem(entity.Id); item.Editing.BeginEdit(); PropertyInfo mappedProperty = mapEntry.MappedProperty; object resolvedValue = DomainEntityPropertyResolver.ResolveItemFieldValue(mappedProperty, mappedProperty.GetValue(entity, null)); item.Fields[mapEntry.MappedTo].Value = resolvedValue.ToString(); item.Editing.EndEdit(); } }
public CrudRepository() { m_resolver = new DomainEntityPropertyResolver(); }
public Repository() { m_resolver = new DomainEntityPropertyResolver(); m_resolver.ConcreteTypeNeeded += Resolver_ConcreteTypeNeeded; }