Fluent Nhibernate - 将对象保存到数据库
我的 WCF 服务是报告服务 - 创建报告并将其作为电子邮件发送。根据要求,电子邮件中的报告可以是附件/电子邮件正文。
现在,客户希望在发送电子邮件之前预览电子邮件,因此我的 WCF 服务需要将整个电子邮件对象返回到调用 Web 应用程序。如果客户对电子邮件对象感到满意,他们只需单击“发送”,然后将再次调用 WCF 服务来发送电子邮件。
我想在将电子邮件对象发送给客户进行审查之前将其保存在数据库中。 考虑到以下情况,在我的场景中保存电子邮件对象的最佳方法是什么:
- 我正在使用 Fluent NHibernate
- 每个电子邮件对象可以有多个附件
- 当报告不是附件而是作为电子邮件正文嵌入时,电子邮件消息正文可能很重。
谢谢你!
My WCF service is a reporting service - create reports and send them as email. Reports in the email can be an attachment/email body depending on the requirement.
Now, client wants to preview emails before they are being sent out, so my WCF service needs to return whole email object to calling web app. If client is happy with emails object, they can simply click 'Send out' which will then again call WCF service to send the emails.
I was thinking to save Email objects in database before they are sent to client for review.
What would be the best approach to save email object in my scenerio considering:
- I am using Fluent NHibernate
- Each Email object can have multiple attachment
- When instead of attachment, reports are being embedded as email body, Email message body can be heavy.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这完全取决于生成报告需要多长时间。如果只需几秒钟,则只需使用与原始请求相同的参数重新创建报告即可。如果您的应用程序与我的应用程序类似,那么大部分报告时间都花在数据库中,在这种情况下,将从查询/存储过程返回的格式化数据存储在可访问的地方(例如,存储在应用程序的临时目录中)可能会令人满意。服务器。
我不建议将二进制电子邮件对象或任何此类性质的内容存储在数据库中。
It all depends on how long it takes the reports to generate. If it's a matter of seconds then just recreate the report using the same parameters as the original request. If your app is anything like mine then the majority of the reporting time is spent in the database, in which case it might be satisfactory to store the formatted data returned from the query/stored procedure somewhere accessible, for example in the temp directory of the server.
I wouldn't recommend storing the binary email objects or anything of that nature in a database.