我们如何使用LS读写文件到服务器? [英] How do we read and write files to the Server with LS?

查看:83
本文介绍了我们如何使用LS读写文件到服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用LS读取和写入服务器文件的最佳方法是什么?


Dan Seefelt的CSV导入/导出博客为我们提供了解决方案(最佳实践指南) ) 用于从客户端读取和写入文件。


可能有多种解决方案可能适用于服务器端。  什么是最好的?


我们当前的应用程序要求是通过程序代码在客户端目录和服务器 站点子目录之间简单地读取和写入文件。  


为了清楚起见(我知道我在这里说明了很明显),System.IO.FileInfo和System.IO.Stream 对象必须可以在 屏幕和实体中访问事件。

解决方案


使用LS读取和写入服务器文件的最佳方法是什么?


Dan Seefelt的CSV导入/导出博客为我们提供了一个解决方案(最佳实践指南) 用于从客户端读取和写入文件。


可能有多种解决方案可能适用于服务器端。  什么是最好的?


我们当前的应用程序要求是通过程序代码在客户端目录和服务器  site子目录之间简单地读取和写入文件。  


为了清楚起见(我知道我在这里说明了很明显),System.IO.FileInfo和System.IO.Stream 对象必须可以访问   屏幕和实体事件。




我不建议将其作为"最佳解决方案",更多我的意思感觉是解决方案空间的概述。 


问题分解为两部分 - 从客户端到服务器(并返回)获取文件数据,然后读取或保留它服务器。


用于移动任意文件你可能想要一个BLOB专栏的实体。 我们支持IMAGE开箱即用,这对于此目的来说已经足够了。 如果您要移动大型文件,则需要修改客户端HTTP超时
以允许> 30秒的通话。


或者,如果您想要更好的交互性,您的实体可以包括名为"peicenumber"的第3列。或序列号或hwatever,您的客户端/服务器协议可能会将文件分成较小的部分,因此没有单个部分比发送或接收的30秒客户端超时花费更长的
。 这显然使服务器和客户端上的文件重建变得复杂,但它可能有其他优点。


关于文件的编写 - 我会想到在你的-ing方法中实体将使IMAGE数据无效,或者可能调用实体上的cancle更改,以便根本不写任何内容。 (这是LS
服务器调用的通用"消息传递"模式 - 通信,但不保留)


-ing方法也将负责在服务器上创建文件并将其写出来。


我猜测你可以覆盖这个实体上的查询方法来读取磁盘上的文件并将其放入发回的实体中客户。 请注意,该实体的状态可能很奇怪,因为服务器已对其进行了技术修改。 
如果你实际上没有将文件数据读/写到数据库,你可能没问题。


显然,自定义RIA提供商会让你跳过任何"hacks" ;在等式的存储/转发部分,但是您可以使用内部存储完成所有操作并且没有实际的实体/数据库提交,我猜。


 


What is the best way to read and write files to the Server with LS?

Dan Seefelt's CSV Import/Export blog provides us with a solution (best practices guide) for reading and writing files from the Client.

There are probably several solutions that might work for the Server side.  What would be the best?

A current application requirement that we have is to simply read and write files between a client directory and a server site subdirectory via program code.  

Just to be clear (I know that I'm stating the obvious here), the System.IO.FileInfo and System.IO.Stream objects would have to be accessable within the Screen and Entity events.

解决方案

What is the best way to read and write files to the Server with LS?

Dan Seefelt's CSV Import/Export blog provides us with a solution (best practices guide) for reading and writing files from the Client.

There are probably several solutions that might work for the Server side.  What would be the best?

A current application requirement that we have is to simply read and write files between a client directory and a server site subdirectory via program code.  

Just to be clear (I know that I'm stating the obvious here), the System.IO.FileInfo and System.IO.Stream objects would have to be accessable within the Screen and Entity events.


I am not proposing this as "the best solution", more what i feel is the overview of the solution space. 

The problem decomposes into two parts -- getting the file data from client to server (and back), and then reading or persisting it on the server.

For moving arbitrary files back and forth you probably want an entity with a BLOB column.  We support IMAGE out of the box and that would be good enough for this purpose.  If you'll be moving large files you'll need to modify the client HTTP timeout to allow for >30 second calls.

Alternatively, if you wanted better interactivity, your entity could include a 3rd column called "peicenumber" or sequence number or hwatever, and your client/server protocol could chunk the file into smaller parts, so that no individual part took longer than the stock 30s client timeout to send or receive.  That obviously complicates the reconstruction of the file on server and client ends, but it might have other advantages.

Regarding writing of the file -- i would envision that in your -ing method for the entity would null out the IMAGE data, or perhaps call cancle changes on the entity so that nothing was written at all. (this is the generic "message passing" pattern for LS server calls -- communicate, but don't persist)

the -ing method would also then be responsible for creating the file on the server and writing it out.

I would surmise that you could override the query methods on this entity to read the file off disk and put it into the entity sent back to the client.  Note that the state of that entity might be strange, since the server has technically modified it.  If you aren't actually reading/writing the file data to a database, you might be alright.

Obviously, a custom RIA provider would let you skip any "hacks" in the storage/retreival part of the equation, but you could do it all with the intrinsic store and no actual entity/db commits, i'm guessing.

 


这篇关于我们如何使用LS读写文件到服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆