views:

36

answers:

1

I have primary key sequence for oracle in my Castle ActiveRecord class:

[PrimaryKey(PrimaryKeyType.SeqHiLo, "UserId", SequenceName = "users_seq")]
public int Id { get; set; }

Now i need to configure ActiveRecord to use Sql Server, but it does not support sequences, but it's not possible, since oracle-specific mapping is used.

I don't care about identity-generation algorithm, i just want it to work, so is it possible to provide a general mapping for identity field, so the classes could be shared between sql server and oracle?

+2  A: 

You can use PrimaryKeyType.Native - it automagically chooses between SeqHiLo and HiLo depending on the database.

Have a look at the docs for other srategies - most of them are database-independent.

VladV