title: Method cannot be translated into a store expression (LINQ)
body: <p>This is my get/set method where I encrypt the password:</p>
  
  <pre><code>[Required]
  [DataType(DataType.Password)]
  [Display(Name = "Password")]
  public string Password {
      set {
          var emp = db.Employees.Find(2);
          password = EncryptDecrypt.Encrypt(emp.Password, "a15s8f5s6e2s3g1w5");
      }
      get {
          return password;
      }
  
  }
  </code></pre>
  
  <p>I use the following code to allow the user to login and I also use it to decrypt the password:</p>
  
  <pre><code>private Employee slogin;
  
              using (var db = new Entities())
              {
                  var erg = from s in db.Employees
                            where s.LastName.ToString() == model.UserName &amp;&amp; s.Password == EncryptDecrypt.Decrypt(model.Password, "a15s8f5s6e2s3g1w5")
                            select s;
                  slogin = erg.FirstOrDefault();
  
              }
  </code></pre>
  
  <p>Every time when I run the code I get a NotSupportedException here: slogin = erg.FirstOrDefault();</p>
  
  <blockquote>
    <p>{"LINQ to Entities does not recognize the method 'System.String
    Decrypt(System.String, System.String)' method, and this method cannot
    be translated into a store expression."}</p>
  </blockquote>