如何在wcf服务中替换应用程序对象? [英] How do i replace application object in wcf service?

查看:57
本文介绍了如何在wcf服务中替换应用程序对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想在WCF服务中转换我的网络服务(.asmx)。



和我根据WCF服务编码模式转换了所有方法。



但是我没有任何应用程序对象的解决方案。



请大家请尽快给我一个解决方案。



先谢谢。



我的代码是



应用程序[newDataKey] = dataval;我想在wcf转换这行代码。





谢谢,

Vipul Patel

Hi,

I want to convert my web service (.asmx) in WCF service.

and i have converted all method as per WCF service coding pattern.

but I have no any solution for "Application" object.

Kindly request to all of you please give me a solution as soon as possible.

Thanks in Advance.

my code is

Application[newDataKey] = dataval; i want to convert this line of code in wcf.


Thanks,
Vipul Patel

推荐答案

据我所知,您无法在WCF应用程序中使用应用程序对象。因此,您需要创建自己的自定义类,其行为类似于应用程序对象。



您需要做的是在WCF应用程序中创建名为Application的新静态类,如下所示,并在WCF应用程序中将其用于应用程序范围的缓存。



As per my knowledge you can not use application object in WCF application.So you need to create your own custom class that behaves like application object.

What you need to do is create new static class in your WCF application with name "Application" as given below and use it in WCF application for application wide caching.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public static class Application
{
      public static Dictionary<string, object> Setting = new Dictionary<string, object>();
}





以下使用此课程的语法



Below syntax for using this class

Application.Setting[newDataKey] = dataval;


这篇关于如何在wcf服务中替换应用程序对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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