예제 #1
0
        /// <summary>
        /// Insert or Replace the Record
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public T Update <T>(string tableName, string pk, string rk, T data, DataSourceEnum dataSourceEnum = DataSourceEnum.Unknown)
        {
            var myReturn = default(T);

            if (string.IsNullOrEmpty(tableName))
            {
                return(myReturn);
            }

            if (string.IsNullOrEmpty(pk))
            {
                return(myReturn);
            }

            if (string.IsNullOrEmpty(rk))
            {
                return(myReturn);
            }

            if (data == null)
            {
                return(myReturn);
            }

            // If under Test, return True;
            if (DataSourceBackend.GetTestingMode())
            {
                return(myReturn);
            }

            return(UpdateDirect <T>(tableName, pk, rk, data, dataSourceEnum));
        }
예제 #2
0
        /// <summary>
        /// Delete the record
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool Delete <T>(string tableName, string pk, string rk, DataSourceEnum dataSourceEnum = DataSourceEnum.Unknown)
        {
            if (string.IsNullOrEmpty(tableName))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(pk))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(rk))
            {
                return(false);
            }

            // If under Test, return True;
            if (DataSourceBackend.GetTestingMode())
            {
                return(true);
            }

            return(DeleteDirect <T>(tableName, pk, rk, dataSourceEnum));
        }
예제 #3
0
        //public DataSourceEnum DataSourceServerMode = DataSourceEnum.Local;

        public bool SetDataSourceServerMode(DataSourceEnum dataSourceServerMode)
        {
            var connectionString        = string.Empty;
            var StorageConnectionString = GetDataSourceConnectionString(dataSourceServerMode);

            // If under Test, return True;
            if (DataSourceBackend.GetTestingMode())
            {
                return(true);
            }

            return(SetDataSourceServerModeDirect(StorageConnectionString));
        }
예제 #4
0
        /// <summary>
        /// Load All Rows that match the PK
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="pk"></param>
        /// <returns></returns>
        public List <T> LoadAll <T>(string tableName, string pk, bool convert = true, DataSourceEnum dataSourceEnum = DataSourceEnum.Unknown)
        {
            var myReturnList = new List <T>();

            if (string.IsNullOrEmpty(tableName))
            {
                return(myReturnList);
            }

            if (string.IsNullOrEmpty(pk))
            {
                return(myReturnList);
            }

            // If under Test, return True;
            if (DataSourceBackend.GetTestingMode())
            {
                return(myReturnList);
            }

            return(LoadAllDirect <T>(tableName, pk, dataSourceEnum, convert));
        }