Sorry I meant:  Component("organization_entity_information_extractor",
IEntityInformationExtractor of Organization,
OrganizationInformationExtractor)

On Thu, Sep 23, 2010 at 9:49 AM, Humberto Franco
<[email protected]>wrote:

> Here is an example from my model:
>
> public class
> OrganizationInformationExtractor:IEntityInformationExtractor<Organization>
>     {
>         private readonly IOrganizationRepository _organizationRepository;
>
>         public OrganizationInformationExtractor(IOrganizationRepository
> organizationRepository)
>         {
>             _organizationRepository = organizationRepository;
>         }
>
>         public Guid GetSecurityKeyFor(Organization entity)
>         {
>             return entity.SecurityKey;
>         }
>
>         public string GetDescription(Guid securityKey)
>         {
>             var org =
> _organizationRepository.FindBySecurityKey(securityKey);
>             return string.Format("Organization: {0}", org.Name);
>         }
>
>         public string SecurityKeyPropertyName
>         {
>             get { return "SecurityKey"; }
>         }
>     }
>
> Registering it in binsor: Component("user_entity_information_extractor",
> IEntityInformationExtractor of User, UserInformationExtractor)
>
> Hope this helps.
>
> On Thu, Sep 23, 2010 at 9:06 AM, jcgroups <[email protected]> wrote:
>
>> Hi,
>>
>> I am implementing IEntityInformationExtractor as below
>>
>> public class EntityInformationExtractor<TEntity> :
>> IEntityInformationExtractor<TEntity> where TEntity : Entity,
>> ISecurableEntity
>>
>> Registering it as
>>
>> Component.For(typeof(IEntityInformationExtractor<>)).ImplementedBy(typeof(EntityInformationExtractor<>)).LifeStyle.Transient
>>
>> Company is declared like 'public class Company : Entity,
>> ISecurableEntity'
>>
>> when I call something like AddEntityToEntitiesGroup(company,
>> "Companies");
>>
>> I am getting an exception
>> GenericArguments[0],
>> 'Website.Core.Contracts.Security.ISecurableEntity', on
>> 'Website.Core.Security.EntityInformationExtractor`1[TEntity]' violates
>> the constraint of type 'TEntity'.
>>
>> Any ideas what I am doing wrong?
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Rhino Tools Dev" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<rhino-tools-dev%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rhino-tools-dev?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to