C# Report Wizard and Entity Framework
This is probably quite simple, but I just don't know how to do this...
I have a reasonable complex SQL Server database containing multiple schema's for data and a generic view to provide information over all those views. (Basically, it lists all extended properties of all schema's.) This setup cannot be changed since every schema is specific for one single office, while the whole database contains all company data.
I'm using the Entity framework to connect to all the data inside those schema's and to link them together. This makes it easy to retrieve whatever data I need. Thus, the configuration file contains one connection string for the entity framew开发者_如何学Pythonork.
I'm also using a single report to create a matrix overview of all the schema data. This is a matrix based on a view with three fields: Schemaname, field and value. The report puts the schemaname vertical as row-header, fieldname horizontal as column header and the value in the cells. But this report uses it's own connection string in the configuration.
I need both to share the same connection! Or at least the same connection string in the configuration. What options do I have?
It's trivial to retrieve the DB connectionstring from the EF connectionstring. Use EntityConnectionStringBuilder to parse it. You can also supply a connection to an EF context.
精彩评论