public object GetEntities(object Entity, List <string> propertiesToUseInFilter = null)
        {
            var Statement = DMLStatementFactory.GetDMLStatementForGenericEntity(_tenant, Entity, DMLStatemtType.SelectAll, propertiesToUseInFilter);

            this.SqlStatementExecuted(Statement.PreparedStatement, Statement.Variables);
            return(((IExecuteDML)_dbaccess).Execute(Statement));
        }
        public void CreateEntity(object Entity)
        {
            var Statement = DMLStatementFactory.GetDMLStatementForGenericEntity(_tenant, Entity, DMLStatemtType.Insert, null);

            ((IExecuteDML)_dbaccess).Execute(Statement);

            //this.sqlStatementExecuted(Statement.PreparedStatement);


            SqlStatementExecuted?.Invoke(Statement.PreparedStatement, Statement.Variables);
        }
        public long UpdateEntity(object Entity)
        {
            EntityDescriber ed = new EntityDescriber(Entity);

            if (ed.UniqueKeyProvidedOnEntity() == false && ed.PrimaryKeyProvidedOnEntity() == false)
            {
                throw new Exception("Neither a Primary Key nor UniqueKey was provided for the object.");
            }

            var Statement = DMLStatementFactory.GetDMLStatementForGenericEntity(_tenant, Entity, DMLStatemtType.Update, null);
            var ret       = (Int32)((IExecuteDML)_dbaccess).Execute(Statement);

            SqlStatementExecuted?.Invoke(Statement.PreparedStatement, Statement.Variables);
            return(ret);
        }