1
Vote

Missing Data Types: money & xml

description

Yesterday I attempted to rebuild the Northwind database using only RikMigrations as a proof-of-concept. Obviously views & stored procedures are not yet available, but I was somewhat surprised to come across two data types that I had no way of creating: "money" and "xml".
 
I'm not terribly familiar with the "money" data type as I've always used "decimal". Upon further reading it appears that "money" predated "decimal" and other than a few minor conveniences there is no longer any reason to use it. The "xml" data type on the other hand is becoming used more and more often in each successive version of SQL Server.
 
Any plans on allowing RikMigrations users to create columns of these types? Perhaps an overload to the Table.AddColumn method that allows the user to pass the type in as a string, with the trade-off being that the user is then obviously tying their code to a single database provider and losing some of RikMigrations built-in validations?

comments

rikware wrote Dec 6, 2007 at 7:53 AM

This is somewhat available at the moment. If you set the "SqlType" field on a column it will use that string instead of one calculated from the type passed in the constructor. However, as you point out, there needs to be a constructor to do this with.

The closest corresponding CLR type to money is decimal which currently maps to the SQL decimal type. This will probably stay the same so you will need to use the overriding SqlType string for that. Xml is an interesting one. There's probably a few CLR types which could map to SQL xml. I'd love any suggestions on what types should be mapped.

I'm actually heading off for a week very soon so I probably won't be able to fix this issue immediately but I will add the string based constructor and map some types for xml once I'm back.

TroyGoode wrote Dec 6, 2007 at 3:27 PM

Ah, that is good to know. Perhaps System.Xml.XmlDocument would make sense for the xml data type?

rikware wrote Mar 28, 2008 at 1:11 AM

There still needs to be some XML types mapped. The XLINQ types are other candidates (XDocument, XElement)

TroyGoode wrote Apr 2, 2008 at 3:50 AM

Given the release of 3.5, I would agree that XDocument, XElement makes more sense now. Good thing you waited, eh? =)

AndyStewart wrote Apr 2, 2008 at 8:49 AM

We're currently investigating the best way of using 3.5 without breaking backwards compatibility with v2.0. So this will probably come in once we've figured that out.

wrote Feb 13, 2013 at 12:20 AM