Print Page | Close Window

Custom DataSourceKeyResolver

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=684
Printed Date: 25-Apr-2024 at 7:15am


Topic: Custom DataSourceKeyResolver
Posted By: brianlj
Subject: Custom DataSourceKeyResolver
Date Posted: 12-Feb-2008 at 2:10pm
Hi -
I have been using embedded config information for deployment on IIS, but really need to work out a better solution.
 
I have read what I could find about creating my own DataSourceKeyResolver and the creation of the custom class doesn't seem to be much of a problem.
 
However, I haven't been able to get the default persistence manager to use the custom DataSourceKeyResolver.  Can someone help shed some light on how it becomes aware of and uses the custom resolver?  The documentation seems a little light there.
 
Thanks so much!
Brian



Replies:
Posted By: GregD
Date Posted: 13-Feb-2008 at 6:07pm
Hi, Brian:
 
Copy below from Ch 4 of the Developer Guide. Did you add a probe assembly in IBConfig so DevForce knows where to look for your IDataSourceKeyResolver class?  Easiest if this is a top-level probe assembly so it will be found regardless of the data source you need to access at a given moment.
 
Greg
IdeaBlade
 

Custom DataSourceKeyResolver

Fortunately, it is easy to write a custom DataSourceKeyResolver that does exactly what you want it to do.

ð      Pick a project to hold your key resolver, e.g. AppHelper

ð      Add a top-level probe assembly tag to Ideablade.ibconfig so DevForce can find it.

<?xml version="1.0" encoding="utf-8"?>

<ideaBlade xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance - http://www.w3.org/2001/XMLSchema-instance …

  <probeAssemblyName>AppHelper</probeAssemblyName>

ð      Add the following references to that project:
IdeaBlade.Persistence
IdeaBlade.Util
IdeaBlade.Rdb
// if creating RdbKeys
IdeaBlade.Persistence.Ws
// if creating WsKeys

ð      Write a class that implements IDataSourceKeyResolver.

ð      Decorate the class with the SerializableAttribute ([Serializable] in C#, <Serializable()>_ in VB).

ð      Implement your version of GetKey(KeyName, KeyExtension) to handle the keys you want to manage.

ð      Return null (Nothing in VB) if you want the DefaultDataSourceKeyResolver to determine the key.




Print Page | Close Window