Open
Description
Hi, I am new to RepoDB. Trying it with Postgres. I might be doing something obvious that is wrong as I cannot get it to work. I keep getting this error. Please let me know if there is something I need to try or how to debug this.
RepoDb.Exceptions.MissingFieldsException
There are no database fields found for table 'Account'. Make sure that the target table 'Account' is present in the database and/or at least a single field is available.
Here is my setup:
Setup:
static RepoDbRepository()
{
GlobalConfiguration
.Setup()
.UsePostgreSql();
}
Trying this test:
[Fact]
public void AccountInsertTest()
{
// Initialize the library for global initialization
var repoDb = new RepoDbRepository<Account>(false);
using var connection = DatabaseFactory.CreateSqlConnection(false);
var id = connection.Insert<Account, long>(
new Account
{
AccountStatus = AccountStatus.Active,
AccountType = AccountType.Admin,
DateCreated = DateTime.UtcNow,
DateUpdated = DateTime.UtcNow
});
id.ShouldNotBe(0);
}
Throws the exception:
Here is the table:
CREATE TABLE account(
id bigserial PRIMARY KEY,
type varchar(36) NOT NULL,
status varchar(36) NOT NULL,
companyname varchar(128),
stripecustomerid varchar(36),
datecreated timestamp NOT NULL,
dateupdated timestamp NOT NULL);