简体   繁体   English

在c#3层应用程序上创建PDF:哪一层?

[英]PDF creation on c# 3-layer application: Which Layer?

I am developing a C# 3-layer application: DAL ( Data Access Layer ), BLL ( Business Logic Layer ) and UI (User Interface). 我正在开发一个C# 3层应用程序:DAL( Data Access Layer ),BLL( Business Logic Layer )和UI (用户界面)。 Now I need to create reports on PDF with data coming from DAL so I thought I should create a new class to do it, the question is, where do I put the class in terms of layering? 现在,我需要使用来自DAL数据在PDF上创建报告,所以我认为我应该创建一个新的类来做,问题是,在分层方面我应该把类放在哪里? (PS: I'll be using iTextSharp for the process) (PS:我将在此过程中使用iTextSharp)

The expected result is: User clicks a button on the form, and the new pdf appears on a specified folder. 预期的结果是:用户单击表单上的按钮,新的pdf出现在指定的文件夹中。

It's an important project so I can't afford to mess up :( 这是一个重要的项目,所以我买不起:(

It seems obvious that creating a report based on fetched data is a business logic task, so putting it in that layer initially seems a no-brainer. 显然,基于获取的数据创建报告是一项业务逻辑任务,因此一开始将其放在该层似乎很容易。

You definitely do not want it in the UI in any case, and the DAL does not seem logical either. 无论如何,您绝对不希望在UI中使用它,而且DAL也不合逻辑。 Let the BLL call the DAL and receive the data, then pass that data to a separate component in the BLL which can handle the job of generating the report. 让BLL调用DAL并接收数据,然后将数据传递到BLL中的单独组件,该组件可以处理生成报告的工作。 You can say that that component belongs to the BLL if you want, but I'd consider it more important to ensure it is as separate as possible from the rest of the system (hint: Hide it behind an interface, and only call it via that). 您可以根据需要说该组件属于BLL,但我认为确保该组件与系统的其余部分尽可能分开更为重要(提示:将其隐藏在接口后面,并且只能通过那)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM