Hello,
I'm writing some unit tests in .NET 1.1 that target the AdventureWorks in SQL 2005. However, one of the columns (Person.Contact.AdditionalContactInfo) is of XML type in SQL server. The generated code in PersistanceInfoGenerator (I'm using adapter templates) is shown below. Problems is the the SqlDbType.Xml enum option was added in .NET 2.0, so my generated code doesn't compile under .NET 1.1.
Is there any easy way to force XML columns to be typed as strings for .NET 1.1? Converting to .NET 2.0 isn't an option at the moment. But, as these are just for unit tests, I'm going to use different tables to work around this for the moment.
Thanks in advance.
Murray
Private Sub InitContactEntityMappings()
MyBase.AddElementMapping( "ContactEntity", "AdventureWorks", "Person", "Contact", 15 )
MyBase.AddElementFieldMapping( "ContactEntity", "ContactId", "ContactID", False, CInt(SqlDbType.Int), 0, 0, 10, True, "SCOPE_IDENTITY()", Nothing, GetType(System.Int32), 0 )
MyBase.AddElementFieldMapping( "ContactEntity", "NameStyle", "NameStyle", False, CInt(SqlDbType.Bit), 0, 0, 0, False, "", Nothing, GetType(System.Boolean), 1 )
MyBase.AddElementFieldMapping( "ContactEntity", "Title", "Title", True, CInt(SqlDbType.NVarChar), 8, 0, 0, False, "", Nothing, GetType(System.String), 2 )
MyBase.AddElementFieldMapping( "ContactEntity", "FirstName", "FirstName", False, CInt(SqlDbType.NVarChar), 50, 0, 0, False, "", Nothing, GetType(System.String), 3 )
MyBase.AddElementFieldMapping( "ContactEntity", "MiddleName", "MiddleName", True, CInt(SqlDbType.NVarChar), 50, 0, 0, False, "", Nothing, GetType(System.String), 4 )
MyBase.AddElementFieldMapping( "ContactEntity", "LastName", "LastName", False, CInt(SqlDbType.NVarChar), 50, 0, 0, False, "", Nothing, GetType(System.String), 5 )
MyBase.AddElementFieldMapping( "ContactEntity", "Suffix", "Suffix", True, CInt(SqlDbType.NVarChar), 10, 0, 0, False, "", Nothing, GetType(System.String), 6 )
MyBase.AddElementFieldMapping( "ContactEntity", "EmailAddress", "EmailAddress", True, CInt(SqlDbType.NVarChar), 50, 0, 0, False, "", Nothing, GetType(System.String), 7 )
MyBase.AddElementFieldMapping( "ContactEntity", "EmailPromotion", "EmailPromotion", False, CInt(SqlDbType.Int), 0, 0, 10, False, "", Nothing, GetType(System.Int32), 8 )
MyBase.AddElementFieldMapping( "ContactEntity", "Phone", "Phone", True, CInt(SqlDbType.NVarChar), 25, 0, 0, False, "", Nothing, GetType(System.String), 9 )
MyBase.AddElementFieldMapping( "ContactEntity", "PasswordHash", "PasswordHash", False, CInt(SqlDbType.VarChar), 128, 0, 0, False, "", Nothing, GetType(System.String), 10 )
MyBase.AddElementFieldMapping( "ContactEntity", "PasswordSalt", "PasswordSalt", False, CInt(SqlDbType.VarChar), 10, 0, 0, False, "", Nothing, GetType(System.String), 11 )
MyBase.AddElementFieldMapping( "ContactEntity", "AdditionalContactInfo", "AdditionalContactInfo", True, CInt(SqlDbType.Xml), 2147483647, 0, 0, False, "", Nothing, GetType(System.String), 12 )
MyBase.AddElementFieldMapping( "ContactEntity", "Rowguid", "rowguid", False, CInt(SqlDbType.UniqueIdentifier), 0, 0, 0, False, "", Nothing, GetType(System.Guid), 13 )
MyBase.AddElementFieldMapping( "ContactEntity", "ModifiedDate", "ModifiedDate", False, CInt(SqlDbType.DateTime), 0, 0, 0, False, "", Nothing, GetType(System.DateTime), 14 )
End Sub