I've got a project that is loading ascii data records defined in a Cobol environment. I've got the cobol data structure: things like INVOICE-SECTION, INVOICE-LINE-DETAIL-SECTION etc. with various data fields for each section. There are many sections each of which has a table in my SQL db.
I'm using Entity Framework 4.0. I want to be able to use the name of the section and create an instance of the entity.
I've tried something like this:
var metadata = cntx.MetadataWorkspace;
var cont = metadata.GetEntityContainer(cntx.DefaultContainerName, true, DataSpace.CSpace);
var ent = cont.GetEntitySetByName("C3191_DETAIL_SECTION", true);
var item = Activator.CreateInstance(ent.GetType(), new object[] {1, 1});
I resorted to reflection (which isn't working) but it seems to me there should be some way to coerce EF to do this.
Any ideas?
Thanks