David and I posted at the same time almost ;) It's always better to know that you have to write a cross db application before you start so that you can choose columns that match on all db systems, but I may have found a way for you. Unfortunately, GUID is one of the very few that doesn't port well (Amazing isn't it, you'd think by now these other systems would have it, it's to valuable not to have).
Here is a post on our mutli-provider mode ==> POST
Our Database Independent feature is pretty good and can degrade gracefully on columns that aren't exact matches, i.e. an 'int' can be used for a 'bit' and so on. You could possibly pull this off however on Guids.
Suppose you generate against SQL as your master and you have a string of the proper length to hold the guid in Oracle as your PK. You run our extra Metadata map class against Oracle, the property for those columns will have been defined by SQL and be a guid. You can easily test this out in a quick sample app by following the instructions in the linked post. I'd create a quick little test app and use a single table in SQL and Oracle to test this. Use SQL as your master so your properties are of type guid then overload the PK property in your entity's custom class like so:
I think that has a real good chance of working for you. I can tell you that our entire NUnit suite uses our Database Independent features, we run the same physical binary against all our supported databases including full hierarchical tests. Supporting a single code base it worth it in most cases.
I would be very interested to see how this works for you.
Code:
namespace BusinessObjects
{
public partial class Customers : esCustomers
{
// Override our PK property
public override Guid? CustomerID
{
get
{
if (this.Row == null)
{
this.AddNew();
}
object o = this.Row[CustomersMetadata.ColumnNames.CustomerID];
if (o is string)
{
// It must have come from Oracle, convert it.
return new Guid(o);
}
else
{
// It's already a guid.
return (Guid?)o;
}
}
set
{
base.CustomerID = value;
}
}
}
}
EntitySpaces |
Twitter |
BLOG | Please honor our Software License