I query-ing this from entity framework using WCF, and i want to use the data in phone client side, may i know how can i query more than one data type from the WCF function ?
[OperationContract]
string LoginUser(string email, string password);
ISER.cs
public string LoginUser(string email, string password)
{
string query = @"SELECT VALUE tblUser FROM MyEntities.tblUsers AS tblUser WHERE tblUser.email = @email AND tblUser.password = @password";
ObjectParameter[] parameters = new ObjectParameter[2];
parameters[0] = new ObjectParameter("email", email);
parameters[1] = new ObjectParameter("password", password);
using (var context = new SteamKingEntities())
{
ObjectQuery<string> results = context.CreateQuery<string>(query, parameters);
foreach (string result in results)
{
if (result != null)
{
return result;
}
}
}
return null;
}
Iservice.svc.cs
public Login()
{
InitializeComponent();
_serviceClient = new Service1Client();
_serviceClient.LoginUserCompleted += new EventHandler<LoginUserCompletedEventArgs>(_serviceClient_LoginUserCompleted);
}
private void loginBtn_Click(object sender, RoutedEventArgs e)
{
_serviceClient.LoginUserAsync(txtEmail.Text, txtPassword.Password);
}
private void _serviceClient_LoginUserCompleted(object sender, LoginUserCompletedEventArgs e)
{
if (e.Error == null && e.Result != null)
{
MessageBox.Show("Welcome " + e.Result + "!");
}
else
{
MessageBox.Show(e.Error.Message + " Couldn t Login, Please try again =D");
}
}
login.xaml.cs
我要从实体框架中回到整个桌子,让我在温得和的电话方面逐一处理。
我猜想,需要对ISER方面作一些修改,但我并不严重地知道如何因为一把新电话投向Linq至Q。 请指导我如何为返回做像样的事情。 谢谢。
<>Update>
页: 1 在试图将参数(http://tempuri.org/:LoginUserResult)淡化时有错误。 详情请见InnerException。
i 将该守则修改为。 WCF 习俗目标,但不能将其erial化...... i 猜测这一问题来自WP部分,how 能够使结果化为乌有?