Print Page | Close Window

NumericIdGenerator

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1878
Printed Date: 25-Mar-2025 at 1:01am


Topic: NumericIdGenerator
Posted By: Vincent
Subject: NumericIdGenerator
Date Posted: 10-Jun-2010 at 6:51am
Hi everybody
 
I am trying to generate id before saving using NumericIdGenerator class which I added into my silverlight 4 web project but every time I try to create a new entity it fires the following error below
 

No class implementing IdeaBlade.EntityModel.IIdGenerator was found. If you have implemented this interface, be sure to decorate the class with an Export(typeof(IIdGenerator)) attribute. Also check the IsApplicable(IDataSourceKey) method in your implementation to ensure that it is filtering correctly.

Can anybody with solution to the problem or know how to use NumericIdGenerator class  help me.

Thank you



Replies:
Posted By: GregD
Date Posted: 10-Jun-2010 at 4:15pm
Check the IsApplicable() method in NumericIdGenerator. The sample in the LearningResources returns false unless the DatasourceKey starts with "IdeaBladeTest1", which I'm guessing yours doesn't. 8-)

Just set it to return true, unconditionally, and your sample will probably start working.


Posted By: Vincent
Date Posted: 10-Jun-2010 at 8:28pm
Thank you for the reply
 
The problem is, when I put a break on the Isapplicable function, and start debugging my project, the application executes the NumericIdGenerator class and the Isapplicable function returns true. But when I try to create new entity thereafter,  the error comes out.
 
So I think  Isapplicable function is ok and yet I get the error.


Posted By: GregD
Date Posted: 11-Jun-2010 at 10:59am
Can you show me the code for the IsApplicable method in your NumericIdGenerator class?


Posted By: Vincent
Date Posted: 11-Jun-2010 at 11:40pm

Here is the code

public bool IsApplicable(IDataSourceKey dataSourceKey)

{

//return dataSourceKey.Name.StartsWith("IdeaBladeTest", StringComparison.OrdinalIgnoreCase);

//

return true;

//bool _IsApplicable = dataSourceKey.Name.StartsWith("testEntities", StringComparison.OrdinalIgnoreCase);

//return _IsApplicable;

 

}

 
My proble is with silverlight 4 which does not support reference to these DLLs System.Data; and System.Data.Common; which are used by the NumericIdGenerator class.
 
Is there any other way of making the NumericIdGenerator class available on client side in silverlight without making a reference to it?


Posted By: GregD
Date Posted: 12-Jun-2010 at 7:01am
I'll check into it.


Posted By: GregD
Date Posted: 18-Jun-2010 at 2:17pm
We've updated the NumericIdGenerator in-house to work properly with Silverlight; the new version will be included with our next release. Anyone who needs it before then, please contact Support.



Print Page | Close Window