2

EF 5 に変換しようとしていますが、CreateQuery. どんな助けでも大歓迎です。前もって感謝します。

これはコードです:

using System;
using System.ServiceModel;
using System.Data.Objects;
namespace TestingOneServiceRole
{
    public class Service1 : IService1
{
public void AddUser(string fullName, string userName, string password)
    {
        using (var context = new MyEntities())
        {
            context.AddToUser(new User()
            {
                UserName = userName,
                Password = password,
                FullName = fullName,
            });
            context.SaveChanges();
        }
    }
    public string UserLoginNow(string username, string password)
    {
        string query = @"SELECT value blah.FullName FROM MyEntities.blah AS User WHERE blah.UserName = @username AND blah.Password = @password";
        ObjectParameter[] parameters = new ObjectParameter[2];
        parameters[0] = new ObjectParameter("username", username);
        parameters[1] = new ObjectParameter("password", password);
        using (var context = MyEntities())
        {
            ObjectQuery<string> results = context.CreateQuery<string>(query, parameters);
            foreach (string result in results)
            {
 etc.......
4

2 に答える 2