///<Summary>
        ///Select all rows by foreign key
        ///This method returns all data rows in the table IdentityUserLogin based on a foreign key
        ///</Summary>
        ///<returns>
        ///IList-IDAOIdentityUserLogin.
        ///</returns>
        ///<parameters>
        ///Int32? userId
        ///</parameters>
        public static IList <IDAOIdentityUserLogin> SelectAllByUserId(Int32?userId)
        {
            Doing(null);
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprIdentityUserLogin_SelectAllByUserId;
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("IdentityUserLogin");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

            try
            {
                command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value));

                staticConnection.Open();
                sqlAdapter.Fill(dt);
                Done(null);

                List <IDAOIdentityUserLogin> objList = new List <IDAOIdentityUserLogin>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAOIdentityUserLogin retObj = new DAOIdentityUserLogin();
                        retObj._loginProvider = Convert.IsDBNull(row["LoginProvider"]) ? null : (string)row["LoginProvider"];
                        retObj._providerKey   = Convert.IsDBNull(row["ProviderKey"]) ? null : (string)row["ProviderKey"];
                        retObj._userId        = Convert.IsDBNull(row["UserId"]) ? (Int32?)null : (Int32?)row["UserId"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
        ///<Summary>
        ///Select all rows by filter criteria
        ///This method returns all data rows in the table using criteriaquery api IdentityUserLogin
        ///</Summary>
        ///<returns>
        ///IList-IDAOIdentityUserLogin.
        ///</returns>
        ///<parameters>
        ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake
        ///</parameters>
        public static IList <IDAOIdentityUserLogin> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake)
        {
            Doing(null);
            SqlCommand command = new SqlCommand();

            command.CommandText = GetSelectionCriteria(InlineProcs.ctprIdentityUserLogin_SelectAllByCriteria, null, listCriterion, listOrder, dataSkip, dataTake);
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("IdentityUserLogin");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

            try
            {
                staticConnection.Open();
                sqlAdapter.Fill(dt);
                Done(null);

                List <IDAOIdentityUserLogin> objList = new List <IDAOIdentityUserLogin>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAOIdentityUserLogin retObj = new DAOIdentityUserLogin();
                        retObj._loginProvider = Convert.IsDBNull(row["LoginProvider"]) ? null : (string)row["LoginProvider"];
                        retObj._providerKey   = Convert.IsDBNull(row["ProviderKey"]) ? null : (string)row["ProviderKey"];
                        retObj._userId        = Convert.IsDBNull(row["UserId"]) ? (Int32?)null : (Int32?)row["UserId"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
        ///<Summary>
        ///Select one row by primary key(s)
        ///This method returns one row from the table IdentityUserLogin based on the primary key(s)
        ///</Summary>
        ///<returns>
        ///IDAOIdentityUserLogin
        ///</returns>
        ///<parameters>
        ///string loginProvider, string providerKey, Int32? userId
        ///</parameters>
        public static IDAOIdentityUserLogin SelectOne(string loginProvider, string providerKey, Int32?userId)
        {
            Doing(null);
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprIdentityUserLogin_SelectOne;
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("IdentityUserLogin");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

            try
            {
                command.Parameters.Add(CtSqlParameter.Get("@LoginProvider", SqlDbType.NVarChar, 128, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)loginProvider ?? (object)DBNull.Value));
                command.Parameters.Add(CtSqlParameter.Get("@ProviderKey", SqlDbType.NVarChar, 128, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)providerKey ?? (object)DBNull.Value));
                command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value));

                staticConnection.Open();
                sqlAdapter.Fill(dt);
                Done(null);

                DAOIdentityUserLogin retObj = null;
                if (dt.Rows.Count > 0)
                {
                    retObj = new DAOIdentityUserLogin();
                    retObj._loginProvider = Convert.IsDBNull(dt.Rows[0]["LoginProvider"]) ? null : (string)dt.Rows[0]["LoginProvider"];
                    retObj._providerKey   = Convert.IsDBNull(dt.Rows[0]["ProviderKey"]) ? null : (string)dt.Rows[0]["ProviderKey"];
                    retObj._userId        = Convert.IsDBNull(dt.Rows[0]["UserId"]) ? (Int32?)null : (Int32?)dt.Rows[0]["UserId"];
                }
                return(retObj);
            }
            catch (Exception ex)
            {
                Failed(null, ex);
                Handle(null, ex);
                return(null);
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }