Custom FieldMappings

Hi,

I need to create custom field mappings.
That is the situation where:
Fields in the tables that are compared have different names and maybe even different types.

How do I do that?

Thanks,
Hans.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    This is one of the most common questions in this forum, and the number of approaches that you can use make it difficult to answer. Provided I can get some space on the website soon, I'll make a howto guide for it.

    The basic idea is to create tablemappings, and each tablemapping class has a fieldmappings collection. This is composed of FieldMapping classes, where you specify the fields. There is a 'Status' property on the fieldmapping after you construct it to tell you if the mapping was successful, since some datatypes can't be compared against each other.

    If you find unsuccessful mappings, you can work around this by creating a view in the database for that table, and CAST or CONVERT the data to a compatible datatype, then map the table in one database to a view in the other.
Sign In or Register to comment.