• Duwamish模式的Remoting注意事项(Remoting高手可以不必看了)


    我是一个Remoting新手。所以请大家不要丢砖头。
    本文采取的方式是以IIS作为Remoting宿主。
    服务器端
    1。数据层
        以DataSet或者继承于DataSet为基类
        类上方表明[Serializable]属性
        实现
     
            private VersionDataSet(SerializationInfo info, StreamingContext context) : base(info, context)
            
    {
            }
    一个私有的构造函数,继承于DataSet,用于序列化。
        如果需要在DataColumn中添加信息的话,可以写入ExtendedProperties中
    2。Interface层
        抽象出所有操作的方法,
    3。Rule层
         实现Interface层的操作,继承于MarshalByRefObject
         需要返回数据集的,必须Return或者out方式返回。
    4. Web层
         引用Rule层。
         编写Web.Config
    <configuration>
      
    <system.runtime.remoting>
        
    <application>
          
    <service>
              
            
    <wellknown mode="Singleton" 
                       type
    ="pensharp.BusinessRules.CheckUserRightRule, pensharp.BusinessRules" 
                       objectUri
    ="CheckUserRightRule.soap" /> 
          
    </service>
        
    </application>
      
    </system.runtime.remoting>
    </configuration>

    本文使用Singleton方式。
    客户段
      1。引用Data层,和Interface层
           建立一个RemotingUtility.cs文件,
          建立静态的方法来获取Remoting对象。
            public static ICheckUserRight GetCheckUserRight()
            
    {
                
    return (ICheckUserRight)Activator.GetObject(typeof(ICheckUserRight),"http://172.26.1.28/pensharpRemoting/CheckUserRightRule.soap");
            }

           剩下的就是利用接口来操作数据了。

  • 相关阅读:
    [WM]谁抢走了应用程序的性能?
    只有更烂的程序员
    [WM]n久以前写的ConnMgr类
    [WM][转]PPC中如何找到正在使用中的网络(源代码)
    让IE6支持minwidth和maxwidth的方法(JS实现) + (CSS实现)
    jQuery tab 切换函数
    wap、3g手机的端的网页头部
    复制到系统剪贴板之IE,ff兼容版
    鼠标滑过展开,js版和jquery版
    JS+CSS实现网页滚动条美化
  • 原文地址:https://www.cnblogs.com/wildfish/p/64732.html
Copyright © 2020-2023  润新知