TransactionalNodeService.AddNodeTransactionOperation.ExecuteDomainExistsQuery C# (CSharp) Method

ExecuteDomainExistsQuery() protected method

protected ExecuteDomainExistsQuery ( ) : bool
return bool
        protected bool ExecuteDomainExistsQuery()
        {
            SqlCommand domainExistsQuery = new SqlCommand();
            domainExistsQuery.CommandText = "SELECT COUNT(*) FROM dbo.[Domains] WHERE dbo.[Domains].[DomainUid] = @DomainUid";
            domainExistsQuery.Connection = Connection;

            domainExistsQuery.Parameters.AddWithValue("@DomainUid", DomainId.GetValue());

            object numberOfRows = domainExistsQuery.ExecuteScalar();

            if (numberOfRows != DBNull.Value)
            {
                if (((int)numberOfRows) > 0)
                {
                    return true;
                }
            }

            return false;
        }