This project has moved and is read-only. For the latest updates, please go here.


Complex type column values not written to database



I am using the bulk copy library to write a table for which some of the columns are custom/complex types which themselves contain properties, for example:

public class Person
    public int PersonID { get; set; }
    public int Age { get; set; }
    public string Name { get; set; }
    public PersonProperties PersonProperties { get; set; }

public class PersonProperties
    public int Height { get; set; }
    public int Weight { get; set; }

Person p = new Person{
PersonID = 0,
Age = 10,
Name = "John",
PersonProperties = new PersonProperties{Height = 20, Weight = 30}

List<Person> people = new List<Person>{p};

Using the WriteToServer method correctly writes PersonID, Age and Name to the table.
But the PersonProperties_Height and PersonProperties_Weight fields are null.

Is there something I need to do in the setup or is this a limitation of the library?
In other words, is it required that the Height and Weight fields from PersonProperties must just
be included as regular fields in Person?

If you require me to provide a more comprehensive example I could make a sample solution but hopefully this is clear enough.

Thank you,
Sam Murdoch
Closed Apr 24, 2016 at 8:25 AM by ErikEJ


ErikEJ wrote Mar 25, 2015 at 2:33 PM

The library only supports simple POCO objects, workaround is to create a flat object to pass to the library - it does not attempt to resolve complex types - Pull Request?

wrote Apr 24, 2016 at 8:25 AM