Initialize collection in interceptor

marcus's Avatar

marcus

06 Jun, 2010 10:20 AM via web

I'm trying out something like this

public class DefaultInterceptor : EmptyInterceptor {
    public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types) {
        var details = ((ContentItem) entity).Details;
        var properties = entity.GetType().GetProperties();
        foreach (PropertyInfo propertyInfo in properties) {
            if(details.ContainsKey(propertyInfo.Name)) {
                propertyInfo.SetValue(entity,details[propertyInfo.Name].Value,null);
            }
        }
        return base.OnLoad(entity, id, state, propertyNames, types);
    }
}

but my details collection is always empty here, is there any way of initialize this collection so i can do operations on it?

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      What is the opposite of bad?