How to call function entity framework : I am trying to call function called connectUser that takes 2 arguments, name and password and returns id (number)

The problem is that it does not work and i am getting "NotSupportedException"

       int userID;

       [EdmFunction("Model.Store",  "connectUser")]
        public static int connectUser(String loginName, String loginPass)
        {
            throw new NotSupportedException("Direct calls are not supported.");
        }

        private void btnSignIn_Click(object sender, EventArgs e)
        {
        userID = (Int32)connectUser(loginName.Text, loginPass.Text);
        }

any idea what is going on? I tried several tutorials and basing on them it should work while for me it ignores [EdmFunction("Model.Store",  "connectUser")]