CQRS.Talk.Refactoring1.Queries.Step2.BasicQueries.FindPersonByEmailQuery.FindPersonByEmail C# (CSharp) Метод

FindPersonByEmail() публичный Метод

public FindPersonByEmail ( String email, bool isCurrentlyEmployed = null ) : Person
email String
isCurrentlyEmployed bool
Результат CQRS.Talk.Dependencies.Person
        public Person FindPersonByEmail(String email, bool? isCurrentlyEmployed = null)
        {
            var sql = Sql.Builder.Append("select top 1 * from people")
                         .Append("where email = @0", email);

            if (isCurrentlyEmployed.HasValue)
            {
                sql.Append("and isCurrentlyEmployed = @0", isCurrentlyEmployed);
            }


            var person = database.SingleOrDefault<Person>(sql);

            return person;
        }
    }