fluent-nhibernate

Why does NServiceBus Saga timeout request use wrong Saga ID?

筅森魡賤 提交于 2019-12-25 01:44:29
问题 My Saga message handler (configured as ISagaStartedBy) requests a timeout message for every message received. Debugging through a few messages at a time, I've found the time the first time the handler is fired, the saga ID sent to the timeout manager is different to the one a) persisted in the database and b) the saga ID sent in subsequent messages. The subsequent messages all send the Saga ID from the database. Here's the handler: public void Handle(PaymentRequested message) { int

Why does NServiceBus Saga timeout request use wrong Saga ID?

不想你离开。 提交于 2019-12-25 01:29:00
问题 My Saga message handler (configured as ISagaStartedBy) requests a timeout message for every message received. Debugging through a few messages at a time, I've found the time the first time the handler is fired, the saga ID sent to the timeout manager is different to the one a) persisted in the database and b) the saga ID sent in subsequent messages. The subsequent messages all send the Saga ID from the database. Here's the handler: public void Handle(PaymentRequested message) { int

Map fields from two tables to create a single entity

江枫思渺然 提交于 2019-12-24 19:07:16
问题 I'm working on a feature to add the ability for each of our customers to define a customized registration form for their account and I've run into a bit of a roadblock in creating my Fluent NHibernate mapping for one of the objects. There are two tables involved [RegistrationField] and [AccountRegistrationField] . [RegistrationField] contains a static list of all of the fields that are available to pick from as well as some information on how to render the field (e.g. should it be a textbox,

Create Database and Tables with NHibernate and FluentNHibernate?

匆匆过客 提交于 2019-12-24 17:44:16
问题 I'm looking for any way to create database and tables with NHibernate and FluentNHibernate. How could I do this ? trying. private static ISessionFactory createConnection() { if (session != null) return session; //database configs FluentConfiguration _config = Fluently.Configure().Database( MySQLConfiguration.Standard.ConnectionString( x => x.Server(HOST). Username(USER). Password(PASSWORD). Database(DB) )) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<PerfilMap>()) .Mappings(m => m

Nhibernate Queryover subquery and whereexists with 2 conditions

给你一囗甜甜゛ 提交于 2019-12-24 17:40:11
问题 Consider the following object structure. Product id : int name : string attribute : list of Attribute Attribute id : int name: string value : string product_id : int The questions is: Using QueryOver how to form a subquery to return all products with the following conditions: Select all products where when have attributes at the same time: Attribute name = "Color" Value="Red" and Attribute name = "Size" Value="XXL" ? Edit: Sample sql: select * from Product p where exists (select id from

Configure Fluent Nhibernate with NHibernate.Caches.MemCached

徘徊边缘 提交于 2019-12-24 16:32:15
问题 I am trying to configure Fluent NHibernate with MemCache but I get the following error. I am using MVC5+CastleWindsor+FluentNHibernate+UOW private static ISessionFactory CreateNhSessionFactory() { var connStr = System.Configuration.ConfigurationManager.ConnectionStrings["AESConnect"].ConnectionString; return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008.ConnectionString(connStr)) .Cache(c=>c.ProviderClass(typeof(NHibernate.Caches.MemCache.MemCacheProvider).AssemblyQualifiedName)

Using NHibernate interceptor together with Ninject to retrieve the logged in user

谁说我不能喝 提交于 2019-12-24 13:33:40
问题 I was reading this article and found it quite interesting (thanks @Aaronaught). Was what came closest to solve my problem. The only detail is that in my case I would use the NHibernate interceptor, but an exception is thrown An unhandled exception of type 'System.StackOverflowException' occurred in System.Core.dll Code Session factory: public class SessionFactoryBuilder : IProvider { private ISessionFactory _sessionFactory; private readonly Configuration _configuration; public

Nhibernate Multiple Database in One Transaction

眉间皱痕 提交于 2019-12-24 12:45:28
问题 My program access to 2 databases and do some DB works. I want to do these works in one transaction and if one of them get any error, also another one should NOT be committed. Here where I am right now, the simple code of a program. using (var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { using (var session1 = NHibernateHelper.OpenSession1()) { using (var session2 = NHibernateHelper.OpenSession2()) { using (var trnx1 = session1.BeginTransaction

Delete Cascade is not working with NHibernate

自作多情 提交于 2019-12-24 12:25:04
问题 I have a table Communication which has a reference to PersonCompany. In the mapping for PersonCompany i have defined a Cascade-Delete for this reference: this.HasMany(x => x.Communications) .AsSet() .KeyColumn("PersonCompanyId") .Fetch.Select() .Inverse() .Cascade.Delete(); But when I now execute the fallowing HQL-Query: var sql = "delete from PersonCompany where Person.Id in (:idList) or Company.Id in (:idList)"; with var query = NHibernateHelper.CurrentSession.CreateQuery(sql); query

Unidirectional parent-child association not null

我只是一个虾纸丫 提交于 2019-12-24 12:13:48
问题 I have a class structure which is akin to a PurchaseOrder (parent) and PurchaseOrderLine (child) pattern, where the order lines will only be saved to the DB by saving the parent PurchaseOrder and will only ever be accessed via the parent too. The DB has PurchaseOrderLine.PurchaseOrder set to not permit null values. It seems from searching through the web that it is not possible to have a uni-directional association from PurchaseOrder via an IList property without having to have a property on