问题描述
如果任何人有3层Silverlightarchitecture的任何演示项目,请给我.我是这些Silverlight架构的新手. alredy创建的sliverlight启用像这样的wcf服务,我在其中有一类rrf1公共课程RRF1{[DataMember]公共列表< ddllocation> LocationList {get;放; }}我开了一堂课.我实施的[数据合同]公共类ddlLocation{private int _key;私有字符串_value;[DataMember]公钥{得到{返回_key;}放{_key =值;}}[DataMember]公共字符串值{得到{返回_value;}放{_value =值;}}}和宣言#region方法声明[服务合约]公共接口IRRFInsert{[运营合同]List< ddllocation> getLocationDropdown();}和我用#region将位置值输入下拉菜单公共列表< ddllocation> getLocationDropdown(){List< ddllocation> ddlLocationList = new List< ddllocation>();SqlConnection objCon =新的SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings ["ConnStr"].ToString());DataSet dsLocation = new DataSet();SqlCommand cmdLocation =新的SqlCommand();cmdLocation.Connection = objCon;cmdLocation.CommandText ="usp_Synapse_REC_GetddlLocation";cmdLocation.CommandType = CommandType.StoredProcedure;SqlDataAdapter adaLocation =新的SqlDataAdapter(cmdLocation);//从sip_Location_master ORDER BY LOCATION_NAME中选择LOCATION_ID_PK,LOCATION_NAME"尝试{objCon.Open();adaLocation.Fill(dsLocation);for(int i = 0; i< dsLocation.Tables [0] .Rows.Count; i ++){ddlLocation obj = new ddlLocation();obj.Key = Convert.ToInt32(dsLocation.Tables [0] .Rows ["LOCATION_ID_PK"]);;obj.Value = dsLocation.Tables [0] .Rows ["LOCATION_NAME"].ToString();ddlLocationList.Add(obj);}}抓住{}最后{cmdLocation.Dispose();objCon.Close();objCon.Dispose();}返回ddlLocationList;}#endregion和我给客户端bin的引用..它工作正常..但我不想每次都不想这样创建连接,命令..等..我想要一个框架层,业务层,服务层避免单层.我想你有我的问题:P.请帮助我
If any one has any demo project of 3-tier Silverlightarchitecture , Please give me. I am new to these Silverlight architecture. alredy created sliverlight enable wcf service like this i have one class rrf1 in thatpublic class RRF1{[DataMember]public List<ddllocation> LocationList { get; set; }}i created one class . that i implemented in[DataContract]public class ddlLocation{private int _key;private string _value;[DataMember]public int Key{get{return _key;}set{_key = value;}}[DataMember]public string Value{get{return _value;}set{_value = value;}}}and Declaration#region Method Declaration[ServiceContract]public interface IRRFInsert{[OperationContract]List<ddllocation> getLocationDropdown();}and i used#region Getting Location Values in to the dropdownpublic List<ddllocation> getLocationDropdown(){List<ddllocation> ddlLocationList = new List<ddllocation>();SqlConnection objCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ToString());DataSet dsLocation = new DataSet();SqlCommand cmdLocation = new SqlCommand();cmdLocation.Connection = objCon;cmdLocation.CommandText = "usp_Synapse_REC_GetddlLocation";cmdLocation.CommandType = CommandType.StoredProcedure;SqlDataAdapter adaLocation = new SqlDataAdapter(cmdLocation);//"select LOCATION_ID_PK, LOCATION_NAME from sip_Location_master ORDER BY LOCATION_NAME"try{objCon.Open();adaLocation.Fill(dsLocation);for (int i = 0; i < dsLocation.Tables[0].Rows.Count; i++){ddlLocation obj = new ddlLocation();obj.Key = Convert.ToInt32(dsLocation.Tables[0].Rows["LOCATION_ID_PK"]);obj.Value = dsLocation.Tables[0].Rows["LOCATION_NAME"].ToString();ddlLocationList.Add(obj);}}catch{}finally{cmdLocation.Dispose();objCon.Close();objCon.Dispose();}return ddlLocationList;}#endregionand i gave ref to client bin.. it''s working fine.. but i don''t want like this every time i don''t want creat connect,command.. ect.. that want i want one framework layer , bussness layer, sevice layer to avoid single layer . i think u got my question :P . please help me
推荐答案
这篇关于3层Silverlight体系结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!