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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:30:38+00:00 2026-05-19T12:30:38+00:00

in my mvc project im using nhibernate 3 as orm, but i have a

  • 0

in my mvc project im using nhibernate 3 as orm, but i have a problem with saving and loading images which their type is byte []

public class PersonImage  : PersistentObject
{
    private string _contentType;
    private byte[] _image;

    private Person _person;


    virtual public string ContentType
    {
        get { return _contentType; }
        set
        {
            if ( value != null && value.Length > 20)
                throw new ArgumentOutOfRangeException("Invalid value for ContentType", value, value.ToString());
            _contentType = value;
        }
    }

    virtual public byte[] Image
    {
        get { return _image; }
        set { _image = value; }
    }

     }



 public class PersonImageMap : ClassMap<PersonImage>
{
    public PersonImageMap()
    {
        Schema("personnel");

        Id(p => p.Id);

        Map(p => p.Image)
            .CustomSqlType("varbinary(MAX)")
            .Not.Nullable();

        Map(p => p.ContentType)
            .Not.Nullable();

        }

}

the problem is that i think this image cant be saved correctly because when i load it i just can see a part of image not the whole image!!

  • 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-19T12:30:39+00:00Added an answer on May 19, 2026 at 12:30 pm

    i found it
    the length attribute should be defined in this case

     Map(p => p.Image)
                .Length(2147483647)
                .CustomSqlType("varbinary(MAX)")
                .Not.Nullable();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the start up of a project using ASP.NET MVC and have
I am using a Cairngorm MVC architecture for my current project. I have several
I am working on a ASP.NET MVC website using Nhibernate as my ORM. The
I'm currently working on an ASP.NET MVC project using NHibernate and I need to
I'm about to kick off a new project using NHibernate and ASP.Net MVC and
This is my first serious project using NHibernate and I have setup log4net to
I have created a sample project using ASP.NET MVC 3 Web Application (Razor) template.
I have a project on my local machine to learn NHibernate with ASP.NET MVC
I am using an ASP.NET MVC project and everytime I add a class to
I am using windsor DI framework in one of my MVC project. The project

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.