In (Manual/Modelling domains/Attributes) there is info about [KeyGenerator] which contains properties Kind, Type and CacheSize, but current implementation (from class reference) tells that KeyGeneratorAttribute contains another set of properties: Kind, Name and Type.

Please can you review manual and make changes according to current state of product?

asked Mar 16 '11 at 05:44

Peter%20%C5%A0ulek's gravatar image

Peter Ĺ ulek
492313236


2 Answers:

Thanks, Peter, will be done.

answered Mar 16 '11 at 05:47

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

:/ Manual is still not updated...

(Aug 01 '12 at 08:49) Jos Jos's gravatar image

Yes, sorry for that. We are working on a new version of the documentation. Unfortunately, it requires much more time than writing and testing new and shiny features...

(Aug 03 '12 at 07:01) Dmitri Maximov Dmitri%20Maximov's gravatar image

LOL! I am kinda familiar to this problem Dmitri. Nevertheless the time you spend here to answer questions on issues about these things could as well be spend on updating the documentation and then you'd only have to refer to it from that point on and say: 'Jos, RTFM please!' ;)

(Aug 09 '12 at 07:04) Jos Jos's gravatar image

Jos, thank you for good motivation. I've updated the manual. Hope you'll find it more adequate now.

(Aug 09 '12 at 09:30) Dmitri Maximov Dmitri%20Maximov's gravatar image

Hi all, so now we have DataObject.Net 4.6 and changes for the KeyGenerator but again no documentation :/

So I get this message:

Domain build failed: Service with name "MyKeyGenerator" of type 'KeyGenerator' is not available.

Code:

 [Service(typeof(MyKeyGenerator), Name = "MyKeyGenerator")]
    public sealed class MyKeyGenerator: KeyGenerator
    {

    /// <summary>
    /// Generates new key for the specified <paramref name="keyInfo"/>.
    /// </summary>
    /// <param name="keyInfo"><see cref="T:Xtensive.Orm.Model.KeyInfo"/> that defines key to generate.</param>
    /// <param name="session">Current session.</param>
    /// <returns>
    /// Generated key value.
    /// </returns>
    public override Xtensive.Tuples.Tuple GenerateKey(Xtensive.Orm.Model.KeyInfo keyInfo, Session session)
    {
        return Xtensive.Tuples.Tuple.Create(Guid.NewGuid().ToString().ToUpper());
    }

    /// <summary>
    /// Initializes key generator instance in the specified <paramref name="ownerDomain"/>.
    /// Only keys that have specified <paramref name="keyTupleDescriptor"/> will be requested.
    /// </summary>
    /// <param name="ownerDomain">Domain to use.</param>
    /// <param name="keyTupleDescriptor">Tuple descriptor of requested keys.</param>
    public override void Initialize(Domain ownerDomain, Xtensive.Tuples.TupleDescriptor keyTupleDescriptor)
    {
        //Nothing to do here??            
    }
}

The previous KeyGenerator worked fine and now the new KeyGenerator has some new methods to be implemented but they don't make sense to me and I do not know how to get it to work now.

Some clues on how to use the new KeyGenerator class would be very nice! :)

Cheers! Jos

answered Oct 18 '12 at 10:12

Jos's gravatar image

Jos
44458

edited Oct 18 '12 at 11:38

1

Hello Jos, simple answer is change your attribute to [Service(typeof(KeyGenerator), ...)]. The long answer is we are rewriting manual to fix outdated stuff, key generators would be covered as well.

(Oct 18 '12 at 12:14) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Ok, I will try that. For the Initialize implementation, would it be ok to do this: keyTupleDescriptor.Add(typeof(Guid));

(Oct 24 '12 at 04:44) Jos Jos's gravatar image

You can't because TupleDescriptors are immutable. There is actually little reason for that. DO already knows what keys it will deal with. This parameter is used to provide information about key structure for key generator, not the reverse.

(Oct 24 '12 at 05:28) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Ok. Changing the attribute worked by the way!

(Oct 24 '12 at 07:53) Jos Jos's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×574
×3

Asked: Mar 16 '11 at 05:44

Seen: 5,627 times

Last updated: Oct 24 '12 at 07:53

powered by OSQA