fluent-nhibernate

Sql 2008 Filestream with NHibernate

我的未来我决定 提交于 2020-01-14 18:55:51
问题 I am attempting to use Filestream in sql server 2008 to store user uploaded images. My problem is that NHibernate will not error, but it also will not save the data into the database. No record is created. The Image class below is a custom class (not to be confused with System.Drawing.Image) public class ImageMap : ClassMap<Image> { public ImageMap() { WithTable("Images"); Id(x => x.ImageId).GeneratedBy.GuidComb().WithUnsavedValue(Guid.Empty); Map(x => x.ImageData); Map(x => x.Extension);

Sql 2008 Filestream with NHibernate

╄→尐↘猪︶ㄣ 提交于 2020-01-14 18:55:19
问题 I am attempting to use Filestream in sql server 2008 to store user uploaded images. My problem is that NHibernate will not error, but it also will not save the data into the database. No record is created. The Image class below is a custom class (not to be confused with System.Drawing.Image) public class ImageMap : ClassMap<Image> { public ImageMap() { WithTable("Images"); Id(x => x.ImageId).GeneratedBy.GuidComb().WithUnsavedValue(Guid.Empty); Map(x => x.ImageData); Map(x => x.Extension);

Sql 2008 Filestream with NHibernate

匆匆过客 提交于 2020-01-14 18:54:33
问题 I am attempting to use Filestream in sql server 2008 to store user uploaded images. My problem is that NHibernate will not error, but it also will not save the data into the database. No record is created. The Image class below is a custom class (not to be confused with System.Drawing.Image) public class ImageMap : ClassMap<Image> { public ImageMap() { WithTable("Images"); Id(x => x.ImageId).GeneratedBy.GuidComb().WithUnsavedValue(Guid.Empty); Map(x => x.ImageData); Map(x => x.Extension);

Fluent NHibernate - Remove Schema from Mappings for Testing With SQLite

孤人 提交于 2020-01-14 16:35:06
问题 I am trying to run some tests on my mapping using SQLite. My mappings look like the following: public class UserMap : BaseValidatableDomainMap<User> { public UserMap() { Table("blanka.[User]"); Id(x => x.Id).GeneratedBy.Identity(); Map(x => x.UserName); Map(x => x.FirstName); Map(x => x.MiddleName); Map(x => x.LastName); Map(x => x.EmailAddress); Map(x => x.OtherEmailAddress); Map(x => x.PhoneNumber); Map(x => x.City); References(x => x.Company, "CompanyId"); References(x => x.State, "StateId

FluentNhibernate + private set

时间秒杀一切 提交于 2020-01-14 14:33:11
问题 I'm using auto property with private set, and fluentNhibernate throw an error for me... FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail. * Database was not configured through Database method. This is my class: public class MyClass { public virtual int Id { get; set; } public virtual string PropOne { get; private set; } } This is my map:

Why would my asp.net-mvc site using nhibernate simply stop doing updates and deletes?

断了今生、忘了曾经 提交于 2020-01-14 14:28:32
问题 I have a very simple CRUD asp.net-mvc site that uses nhibernate to interface with a mySQL db. I am using the UnitOfWork and Repository patterns. After upgrading to MVC 4 and the latest nhibernate and mySQL versions (via nuget) I am suddenly seeing a weird issue where updates and deletes have stopped working. Here is an example Delete code in my controller that stopped working: public ActionResult Delete(int id) { MyEvent c = _eventRepository.FindBy(id); _unitOfWork.Begin(); _eventRepository

FluentNHibernate or port to NHibernate mapping by code

这一生的挚爱 提交于 2020-01-14 08:07:08
问题 I have several projects using NH and FNH to generate the mappings (some Fluent some Automapped). There are still some bugs and missing features i need, but it seems that FNH could die because of mapping-by-code integrated into NHibernate. Question: Contribute to FNH or to migrate the mappings to mapping-by-code or confORM and fixing problems/implementing features there? 回答1: At our office, we have been using NHibernate for 3 years now. We've been thinking about making a move to Fluent

Nhibernate and WCF IList<> Conflict

a 夏天 提交于 2020-01-14 03:47:07
问题 i'll use some sample code to demonstrate my problem... this is an entity public class Channel : EntityBase { [DataMember] public virtual IList<LocalChannel> LocalChannels { get; set; } } local channel has a string property. this 2 classes mapped fluently and works fine with the has many relation. the problem is in the wcf service. when i'm selecting a channel or all channels. the localChannels list is fixed size. (the type of ILIst that returns is typed array) i want i to be a List.

Fluent NHibernate Custom Type convention for bools

 ̄綄美尐妖づ 提交于 2020-01-13 20:17:16
问题 Trying to create a convention that applies to all bool properties. Given this class: public class Product { public string Name { get; private set; } public bool IsActive { get; private set; } public Product(string name) { Name = name; } } I have a mapping like: public class ProductMap : ClassMap<Product> { public ProductMap() { Map(x => x.Name); Map(x => x.IsActive).CustomType<YesNoType>(); } } I would like to have a convention that does this. So far I have: public class YesNoTypeConvention :

Mapping a list of Enums

元气小坏坏 提交于 2020-01-13 14:09:16
问题 I have a table called UserPermissions with a FK to the users table by userId and then a string column for the string value of an enum. The error I am seeing is NHibernate.MappingException: An association from the table UserPermissions refers to an unmapped class: GotRoleplay.Core.Domain.Model.Permission My Permission Enum: public enum Permission { [StringValue("Add User")] AddUser, [StringValue("Edit User")] EditUser, [StringValue("Delete User")] DeleteUser, [StringValue("Add Content")]