Click here to Skip to main content
15,888,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody,
i have a project with a Datagrid (Host),
another Project with an Interface(Contract) and
a third Project (Plugin) which References the contract like the host.
(All of them in .Net 4.6)

Seems like normal MEF till now.

I use EF6 inside the Plugin to get information for the host.

So the Host asks for Information and i want to bind the datagrid from the host onto the Information i get from EF.
But I get an IQueryable<EF6Entity> from Ef which i cant give my host because he doesnt know "EF6Entity".
I cast the IQueryable<EF6Entity> to a DataTable right now, but i lose every functionality this way. Like updating the information from datagrid to the database or vice versa.

What do i want to archive:
The host wants data. The Plugin gives the data and if the data (in database) changes, the data inside the host gets updated("Real Time" update for the datagrid.)
The other way around if something changes in my datagrid after i click a "Save Button" the database should be updated.

What is the best approach to get that behaviour? (a code snippet would be nice)
(Cast ObservableCollection + DTO? seems meh. Maybe Reflection?)

Thank you all in advance.

C#
[Export("Test_Informations";, typeof(ITest_Informations))]
    public class Test_Informations : ITest_Informations
    {
        public DataTable GetSomeInformations_DataTable()
        {
            someInformations = getAllSomeData(); //returns IQueryable<DataLayer.Test_SomeInformations> which i cant use outside of the Plugin
            return castToDataTable(someInformations);
        }
     }
Posted
Updated 15-Sep-15 4:25am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900