/// <summary> /// Creates an instance of a DatabaseEntity object that does not exist in the database. /// </summary> /// <param name="tableName">Used to identify with which table the instance is interacting.</param> public DatabaseEntity(string tableName) { ExistingRecord = false; Id = Guid.NewGuid(); TableName = tableName; EntityMembersAsOf = null; SqlCrud = new SqlCrudOperator(Access.DbAccess, TableName); RegisteredColumns = new List <ColumnTuple>(); RegisterMembers(); }
/// <summary> /// Creates an instance of an existing DatabaseEntity object that does exist as a database record. /// </summary> /// <param name="tableName">Used to identify with which table the instance is interacting.</param> /// <param name="id">Used to identify with which record the instance is interacting.</param> public DatabaseEntity(string tableName, Guid id) { ExistingRecord = true; Id = id; TableName = tableName; SqlCrud = new SqlCrudOperator(Access.DbAccess, TableName); RegisteredColumns = new List <ColumnTuple>(); RegisterMembers(); RefreshMembers(); SetRegisteredMembers(); }
/// <summary> /// Creates an instance of a DatabaseEntity object that does not exist in the database. /// </summary> /// <param name="tableName">Used to identify with which table the instance is interacting.</param> public DatabaseEntity(string tableName, DataAccessComponent dbAccess = null) { ExistingRecord = false; Id = Guid.NewGuid(); TableName = tableName; EntityMembersAsOf = null; if (dbAccess == null) { DbAccess = Access.VspDbAccess; } else { DbAccess = dbAccess; } SqlCrud = new SqlCrudOperator(DbAccess, TableName); RegisteredColumns = new List <ColumnTuple>(); RegisterMembers(); }
/// <summary> /// Creates an instance of an existing DatabaseEntity object that does exist as a database record. /// </summary> /// <param name="tableName">Used to identify with which table the instance is interacting.</param> /// <param name="id">Used to identify with which record the instance is interacting.</param> public DatabaseEntity(string tableName, Guid id, DataAccessComponent dbAccess = null) { ExistingRecord = true; Id = id; TableName = tableName; if (dbAccess == null) { DbAccess = Access.VspDbAccess; } else { DbAccess = dbAccess; } SqlCrud = new SqlCrudOperator(DbAccess, TableName); RegisteredColumns = new List <ColumnTuple>(); RegisterMembers(); RefreshMembers(true); SetRegisteredMembers(); }