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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:58:33+00:00 2026-05-13T15:58:33+00:00

I have a little problem with fluentNhibernate and MySQL. I would like to map

  • 0

I have a little problem with fluentNhibernate and MySQL.
I would like to map my entity:

public class Topic
{
    public Topic()
    {
        ParentTopic = null;
    }

    public virtual Guid Id { get; set; }
    public virtual string Name { get; set; }
    public virtual DateTime CreatedAt { get; private set; }
    public virtual Guid CreatedBy { get; set; }
    public virtual IList<Post> Posts { get; set; }
    public virtual Topic ParentTopic { get; set; }
}

To a table with the same name. My bigest problem is how to I do the mapping of the CreatedAt so that in the database I get a timestamp that is only changed on insert and ignored when updating.

thx 😉

  • 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-13T15:58:33+00:00Added an answer on May 13, 2026 at 3:58 pm

    Found the answer to my little problem 🙂

    public class TopicMap : ClassMap<Topic>
    {
        public TopicMap()
        {
            Table("Topics");
            Id(t => t.Id).GeneratedBy.Guid();
            Map(t => t.CreatedAt).Not.Nullable().Generated.Insert().CustomSqlType("timestamp");
            Map(t => t.CreatedBy).Not.Nullable();
            Map(t => t.Name).Not.Nullable().Length(500);
            HasMany(t => t.Posts);
            References(t => t.ParentTopic).Nullable().Cascade.All().ForeignKey("FK_Topic_ParentTopic");
        }
    }
    

    This seams to work in my unit tests. Hope that it will not produce any greater problems in the future.

    If anybody seas a problem with this then please let me know.

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

Sidebar

Related Questions

I have little problem with mysql query. I need something like GROUP_CONCAT in GROUP_CONCAT.
I have a little problem understanding the Java language public class PhonebookEntryList extends List<PhonebookEntry>
I have little problem with printing data like this, I have written script like
I have little problem on the here http//site.com/detial.php?verifyID=$parametre i want this like short url
I have a little problem with multiline UILabel, my UILabel text like starts from
I have little problem with a replacement of a little part in an url.
I have little problem in regular expressin creation. Expected input: blahblahblah, blahblahblah, 'blahblahblah', blahblahblah,
I have little unusual problem to solve. I need some hint or links to
I have a little problem about the sort direction of a specific column in
I have a little problem with Jquery getJSON function. my json here { entries:

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.