C# 报表向导和实体框架
这可能很简单,但我只是不知道如何做到这一点...
我有一个合理的复杂 SQL Server 数据库,其中包含多个数据模式和一个通用视图来提供所有这些视图的信息。 (基本上,它列出了所有架构的所有扩展属性。)此设置无法更改,因为每个架构都特定于一个办公室,而整个数据库包含所有公司数据。
我正在使用实体框架连接到这些架构内的所有数据并将它们链接在一起。这使得检索我需要的任何数据变得容易。因此,配置文件包含实体框架的一个连接字符串。
我还使用单个报告来创建所有架构数据的矩阵概述。这是一个基于视图的矩阵,具有三个字段:架构名称、字段和值。该报告将模式名称垂直放置为行标题,将字段名称水平放置为列标题,并将值放置在单元格中。但此报告在配置中使用它自己的连接字符串。
我需要两者共享相同的连接!或者至少配置中有相同的连接字符串。我有什么选择?
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 framework.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 EF 连接字符串检索数据库连接字符串很简单。使用 EntityConnectionStringBuilder 解析它。您还可以提供与 EF 上下文的连接。
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.