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 6100195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:21:30+00:00 2026-05-23T13:21:30+00:00

I’m having some problems with ActiveRecord. Well everything works fine, but it’s working sometimes.

  • 0

I’m having some problems with ActiveRecord.

Well everything works fine, but it’s working sometimes. Not ALL the time.

When I try to navigate to MVC page that is referenced in a project that contains a spatial entity (theres just one spatial entity – and this entity does not have a spatial type) I get this exception.

{“A GeometryType column has been declared, but there is no spatial dialect configured”}

There is a dialect correctly configured. I’ve tried to configurate it in two ways: Xml and InPlace.

This is my startup method:

    public static void StartActiveRecord()
    {
        IDictionary<string,string> hash = new Dictionary<string,string>();

        hash.Add("isWeb", "true");
        hash.Add("connection.driver_class","NHibernate.Driver.NpgsqlDriver");
        hash.Add("connection.connection_string","Server=localhost;Port=5432;database=nhiber;User ID=postgres;Password=pass;");
hash.Add("connection.provider","NHibernate.Connection.DriverConnectionProvider");
            hash.Add("dialect","NHibernate.Spatial.Dialect.PostGisDialect,NHibernate.Spatial.PostGis");
            hash.Add("proxyfactory.factory_class","NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");

        InPlaceConfigurationSource source = new InPlaceConfigurationSource();
        source.Add(typeof(ActiveRecordBase), hash);
        ActiveRecordStarter.Initialize(source, GetActiveRecordTypes());

        foreach (Configuration cfg in ActiveRecordMediator.GetSessionFactoryHolder().GetAllConfigurations())
        {
            cfg.AddAuxiliaryDatabaseObject(new SpatialAuxiliaryDatabaseObject(cfg));
            //Metadata.AddMapping(cfg, MetadataClass.GeometryColumn);
            //Metadata.AddMapping(cfg, MetadataClass.SpatialReferenceSystem);
        }
    }

And this is my Startup method, in Global.asax

    protected void Application_Start()
    {
        Ignition.StartActiveRecord();

        AreaRegistration.RegisterAllAreas();

        RegisterRoutes(RouteTable.Routes);
    }

This error occurs sometimes. Killing the dev server sometimes makes it ok, but only to crash again a few steps later.

HELP!

EDIT: I’m adding the mappings to this and some other info

When there is a dialect, this errors out in Ignition.StartActiveRecord() on Global.asax. When there is no dialect it errors out in ActiveRecordStarter.Initialize();

Just to be sure, this object mapped below is the ONLY spatial aware object in the entire assembly.

public class Complaint:ActiveRecordBase<Complaint>
{

[PrimaryKey(Column="complaint_id",Generator=PrimaryKeyType.Sequence,SequenceName="complaint_seq")]
        public virtual int ComplaintId { get; set; }

        [Property(Column="date_of_complaint",NotNull=true)]
        public virtual DateTime DateOfComplaint { get; set; }

        [Property(Column="description",Length=256,NotNull=true)]
        public virtual string Description { get; set; }

        [Property(Column="complaint_status",NotNull=true,Default="1")]
        public cityzenComplaintStatus Status { get; set; }

        [BelongsTo(Column = "complaint_type_id")]
        public ComplaintType Type { get; set; }

        [Property("the_geom", ColumnType = "NHibernate.Spatial.Type.GeometryType, NHibernate.Spatial")]
        public virtual IGeometry Geometry { get; set; }

        [OneToOne(ForeignKey="official_answer_id")]
        public virtual OfficialAnswer CityAnswer { get; set; }

        [BelongsTo("user_id", Fetch = FetchEnum.Select, Lazy = FetchWhen.OnInvoke, Update = false, NotNull = true)]
        public virtual CityzenUser User { get; set; }

        [HasMany(typeof(Vote),Table="vote",ColumnKey="complaint_id",RelationType=RelationType.Set,Inverse=true)]
        public virtual IList<Vote> Votes { get; set; }

        [HasMany(typeof(Comment),Table="comment",ColumnKey="complaint_id",RelationType=RelationType.Set,Inverse=true)]
        public virtual IList<Comment> Comments { get; set; }

        [Property(Column = "deleted", Default = "false", NotNull = true)]
        public virtual bool Deleted { get; set; }
}
  • 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-23T13:21:30+00:00Added an answer on May 23, 2026 at 1:21 pm

    Your configuration looks right to me but for whatever reason whenever NH instantiates an instance of GeometryType it cannot find the dialect you are configured to use so that it knows what type of IGeometry you need to initialize (PostGisGeometryType in your case).

    What you may be able to do for a temporary workaround is to declare your member variable like this:

    [Property("the_geom", ColumnType = "NHibernate.Spatial.Type.PostGisGeometryType, NHibernate.Spatial.PostGis")]
    public virtual IGeometry Geometry { get; set; }
    

    If I find anything else out I will post back here.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.