Note that there are some explanatory texts on larger screens.

plurals
  1. POgenericizing conformance checks when importing data
    text
    copied!<p>I am working on an import assistant (C# .NET 4) between 2 MS Access databases and I need to implement a mechanism to ensure data consistency.</p> <p><strong>Example:</strong></p> <p>Import persons.</p> <p><strong>Problem:</strong></p> <p>The columns from the person tables have different column sizes.</p> <p>Source Table: Address column size = 50;</p> <p>Destination Table: Address column size = 30;</p> <p>When we try to import a person with a Address larger than 30 chars a problem appears.</p> <p><strong>Desired solution:</strong></p> <p>When the previous problem appears a dialog needs to be shown where the user can redefine or truncate the value to correspond to the require length. </p> <p><strong>Import function looks something like this</strong> </p> <pre><code>private static void ImportPerson() { var sourcePerson = sourcePerson.GetObject(); if (sourcePerson == null) return; var person = new MyPerson(); person.Address.Value = sourcePerson.Address; person.Company.Value = sourcePerson.Company; person.Save(); } </code></pre> <p>I have metadata information stored in my objects witch allows me to access the column size of my destination columns.</p> <pre><code>person.Address.ColumnSize </code></pre> <p>So I can do something like this after filling business objects with the new values.</p> <pre><code>if (person.Address.ColumnSize.CompareTo(person.Address.Value.Length)) &lt; 0 // show dialog ... </code></pre> <p>Unfortunately this means checking all the properties (Address, Company... and other) individually.</p> <p>I am looking for a more generic approach where I don't need to check every property individually.</p> <p>Any ideas, suggestions, thoughts would be highly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload