Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6790399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:43:15+00:00 2026-05-26T17:43:15+00:00

I have am trying to create some integration tests with no external database dependencies

  • 0

I have am trying to create some integration tests with no external database dependencies so am using SQL CE 4.0 and trying to configure it with FluentNhibernate.

I have gotten so far as having the tests create the database file each time it runs, then create the table that i want to use but it never sets the Id column to and identity specification. When i then try and insert into the table with Nhibernate it complains about a null identity column.

This is my mapping defenition and data class:

public class AffiliateApplicationRecord
{
    public virtual int Id { get; private set; }
    public virtual string CompanyName { get; set; }
    public virtual string Email { get; set; }
    public virtual string DomainName { get; set; }
    public virtual DateTime DateReceived { get; set; }

    public AffiliateApplicationRecord()
    {
        DateReceived = DateTime.Now;
    }
}

public class AffiliateApplicationRecordMap : ClassMap<AffiliateApplicationRecord>
{
    public AffiliateApplicationRecordMap()
    {
        Table("Partner");
        Id(x => x.Id).GeneratedBy.Identity();
        Map(x => x.CompanyName, "Name");
        Map(x => x.DomainName, "Domain");
        Map(x => x.Email);
        Map(x => x.DateReceived, "TimeStampCreated");
    }
}

And these are the methods that configure the Session Factory which i call in my repositories to get a session factory to run queries/insert data.

EDIT: Added Dialect configuration…

private ISessionFactory CreateSessionFactory()
    {

        var config = Fluently.Configure()
            .Database(
                MsSqlCeConfiguration.Standard
                    .Dialect<MsSqlCe40Dialect>()
                    .ConnectionString("Data Source=DatabaseFileName.sdf"))
            .Mappings(m => m.FluentMappings.AddFromAssembly(typeof(AffiliateApplicationRecord).Assembly))
            .ExposeConfiguration(BuildSchema)
            .BuildConfiguration()

        return config.BuildSessionFactory();
    }

    private static void BuildSchema(Configuration config)
    {
        new SchemaExport(config).Create(false, true);
    }

I’d really appreciate help with this. I am worried that either Fluent won’t do this for me or that SQL CE won’t work.

Thanks in advance for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:43:16+00:00Added an answer on May 26, 2026 at 5:43 pm

    After using the SQLCe toolbox i realised that the table was being created with an identity column correctly and that the problem i was seeing (AssertionFailure: “null identifier”) was actually caused by a bug in SQL CE described here…

    AssertionFailure: "null identifier" – FluentNH + SQLServerCE

    Many Thanks SO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some problems while trying to create integration tests with Selenium and
I'm trying to create a Textmate snippet, but have run into some difficulties. Basically,
im trying to create a database for a feedback application in ASP.net i have
I have a VB6 dll that is trying to create a COM object using
I have a Spring/Hibernate webapp that has some integration tests that run on an
I'm trying to create some modal windows that load in their content dynamically using
I have been trying to create a Ruby program that will be running online
I have been trying to create a menu panel with jQuery that can be
I have been trying to create a new google custom search engine, but when
I have been trying to create a simple program with Python which uses OpenCV

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.