Thanks a lot for your reply – I will try your solution now and let you and
the group know about it



*From:* [email protected] [mailto:[email protected]] *On
Behalf Of *Ricardo Peres
*Sent:* Tuesday 09 July 2013 15:50
*To:* [email protected]
*Subject:* [nhusers] Re: How to Create index on component property



See Fabio Maulo's post here
http://fabiomaulo.blogspot.co.uk/2011/07/nhibernate-playing-with-mapping-by-code.html,
specifically the part on auxiliary database objects and see if it helps.



RP

On Tuesday, July 9, 2013 9:04:12 AM UTC+1, Haimon wrote:

Really needs your help. anyone???

On Monday, July 8, 2013 3:27:39 PM UTC+3, Haimon wrote:

I have the following classes:

public class Event

{

    public virtual Guid Id { get; set; }

    public virtual string UserName { get; set; }

    public virtual EventId EventId { get; set; }

}



public class EventId

{

    public virtual Guid EventGuid {get; private set;}

}

I am using a fluent NHibernate automapping in order to map my classes and I
override specific properties when needed.

Class: Event is in s_typesToMap and class: EventId is in s_components.

As a result I get the following table generated:

create table "Event" (

   Id UNIQUEIDENTIFIER not null,

   UserName NVARCHAR(255) null,

   EventIdentifierEventGuid UNIQUEIDENTIFIER null,

   primary key (Id)

)

I want to create an index on EventIdentifierEventGuid which is a property
in Event component.

I tried to do it as follows:

.Override<Event>(obj => obj.Map(x =>
x.EventId.EventGuid).Index("EventId_index"))

When I generate the ddl I get the following:

create index EventId_index on "Event" (EventGuid)

The expected result should be an index on EventIdentifierEventGuid instead
of EventGuid

How can I do it?

-- 
You received this message because you are subscribed to a topic in the
Google Groups "nhusers" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/nhusers/YL2Fnkg0Sg8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
[email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to