问题多实例代理wcf服务c#
我在问题多实例代理wcf服务c#,c#,wcf,C#,Wcf,我在c的wcf服务公司工作。我需要在BL和DAL结构中创建一个不同类的intance,但在我的表单中,我有: public BaseServiceReference.BaseServiceClient proxy ; public BaseServiceReference.BaseServiceClient proxyGroups; public List<User> list; public List<Group> listGroup; public User Sea
c
的wcf
服务公司工作。我需要在BL
和DAL
结构中创建一个不同类的intance,但在我的表单中,我有:
public BaseServiceReference.BaseServiceClient proxy ;
public BaseServiceReference.BaseServiceClient proxyGroups;
public List<User> list;
public List<Group> listGroup;
public User SearchModel;
public List<EnumBase> estatusList;
public Users()
{
InitializeComponent();
proxy = new BaseServiceReference.BaseServiceClient();
proxyGroups = new BaseServiceReference.BaseServiceClient();
proxy.setWorkBL("User", typeof(int).ToString());
proxyGroups.setWorkBL("Group", typeof(int).ToString());
estatusList = Tools.GetEnumList<Estatus>(true,"All");
listGroup = new JavaScriptSerializer().Deserialize<List<Grupo>>( proxyGroups.GetStandarList());
CB_Estatus.DataSource = estatusList;
CB_Estatus.ValueMember = "Id";
CB_Estatus.DisplayMember = "Name";
var lisGr = (from g in listGroup where g.Status.Value.Equals((int)Status.Active) select new { g.Id, g.Name }).ToList();
lisGr.Insert(0, new { Id = -1, Name = "All" });
CB_Group.DataSource = lisGr;
CB_Group.ValueMember = "Id";
CB_Group.DisplayMember = "Name";
dataGridView1.CellPainting += DataGridView1_CellPainting;
LoadGrid();
}
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single)]
public class BaseService : IBaseService
{
[DataMember]
public static dynamic BL { get; set; }
public void setWorkBL(string name, string type)
{
Type tp = Type.GetType("BL." + name + "BL, BL");
var instance = Activator.CreateInstance(tp);
dynamic file = instance;
BAL = file;
}
}
但是当你排队的时候
proxyGroups.setWorkBL("Group", typeof(int).ToString());
在加载gridview
后,在firts var proxy affer中使用字符串paramGroup
有什么问题吗?有点猜测,但是。。。不要在这里使用
static
:publicstaticdynamicbl{get;set;}
我尝试了这个方法,但是显示了null值的错误有点猜测,但是。。。不要在这里使用static
:publicstaticdynamicbl{get;set;}
我尝试了这个方法,但是显示了一个空值错误