fluent

NHibernate 3.1 migration problem with Linq

拈花ヽ惹草 提交于 2019-12-10 18:55:16
问题 I am facing a issue regarding the migration from NHibernate 2.1.2 + Fluent 1.0 to NHibernate 3.1 + Fluent 1.2 : Used to work : List<Order> orders = session.Linq<Order>() .Where(o => o.OrderLines.Any(ol => printStatuses.Contains(ol.PrintStatus))) .ToList(); Don't work anymore List<Order> orders = session.Query<Order>() .Where(o => o.OrderLines.Any(ol => printStatuses.Contains(ol.PrintStatus))) .ToList(); We get the following error : "Could not load type o.OrderLines . Possible cause: the

Generic fluent Builder in Java

試著忘記壹切 提交于 2019-12-10 15:32:08
问题 I'm aware there've been similar questions. I haven't seen an answer to my question though. I'll present what I want with some simplified code. Say I have a complex object, some of its values are generic: public static class SomeObject<T, S> { public int number; public T singleGeneric; public List<S> listGeneric; public SomeObject(int number, T singleGeneric, List<S> listGeneric) { this.number = number; this.singleGeneric = singleGeneric; this.listGeneric = listGeneric; } } I'd like to

Problems after merging Fluent into main.exe

放肆的年华 提交于 2019-12-10 14:05:55
问题 My Question is about a Fluent, which i merged with my program.exe in one merged.exe with this code: public class Program { [STAThreadAttribute] public static void Main() { AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly; App.Main(); } private static Assembly OnResolveAssembly(object sender, ResolveEventArgs args) { //We dont' care about System Assemblies and so on... //if (!args.Name.ToLower().StartsWith("wpfcontrol")) return null; Assembly thisAssembly = Assembly

I get an error in my first (fluent) nhibernate query Initializing[type]-failed… no session or session was closed

喜夏-厌秋 提交于 2019-12-10 10:09:22
问题 I just started with NHibernate, created my mappings using fluent NHibernate as follows: public class CustomerMap : ClassMap<Customer> { public CustomerMap() { Id(x => x._id, "Id"); Map(x => x._KdNr, "KdNr"); Map(x => x._Name, "Name"); HasMany(x => x._Contact) .Table("Contacts") .KeyColumn("FKCustomerID") .LazyLoad(); } } public class ContactMap : ClassMap<Contact> { public ContactMap() { Id(x => x._id, "Id"); Map(x => x._Name, "Name"); } } And to save new records works also: public static

Schema specified is not valid. Errors: The relationship was not loaded because the type is not available

廉价感情. 提交于 2019-12-09 04:30:47
问题 I wish to reference the OrderAddress model twice in my Order model; once as a ShippingAddress and once as a BillingAdress . On the other side, I want my OrderAddress model to have a list of OrderAddresses . OrderAddress Model public enum AddressType { Billing, Shipping, Contact } public class OrderAddress : BaseModel { public AddressType AddressType { get; set; } public bool IsPrimary { get; set; } public string Address { get; set; } public string CityStateZip { get; set; } public string

Fluent NHibernate does not create IN part of WHERE clause

不想你离开。 提交于 2019-12-09 03:13:54
问题 I have Fluent NHibernate Linq queries where I check values based on run time arrays. A basic example would be something like: var array = [1,2,3,4,5,6]; using (var session = SessionProvider.SessionFactory.OpenSession()) { return session.Query<MyObject>().Where(x => array.Contains(x.CompareVal)).ToList(); } I would expect the generated SQL statement to look something like this: SELECT CompareVal, Column1, Column2 FROM MyObject WHERE CompareVal IN (1,2,3,4,5,6) However, what I'm finding instead

How do I use Fluent NHibernate ReferencesAny mapping?

只谈情不闲聊 提交于 2019-12-08 11:59:49
问题 I've read a lot about Fluent NHibernate's ReferencesAny but I haven't seen a complete example. I think I understand most of it, but there is one part I don't get. In the class mapping ReferencesAny(x => x.MemberName) is used to define the relationship to the one or more referenced classes. What is MemberName ? How is it defined and how is it used to create the data in the database. I have three tables, the records in one table can reference records in one of the other two tables. The first

Matching chained method calls with structural search

江枫思渺然 提交于 2019-12-08 11:32:57
问题 I try to match this kind of method calls of some fluent API. There can be an arbitrary number of method calls (at least 2 calls, but no upper limit). The whole expression should be matched. Actually, the goal is to find chained method calls in a fluent api which omit doIt() , as in this case the fluent API does nothing. FooClass.some("fluent") .api() .bar(()->"somelambda") .doIt(); I tried something like FooClass.$a$($b$) and use different "occurence counts" like 0,∞ for $a$ , and 0,1 for $b$

MySQL Configuration for Fluent NHibernate

廉价感情. 提交于 2019-12-08 09:48:37
问题 I have class-configurer fluent nhibernate for MySQL: class MySqlInitializer : INHibernateInitializer { public Configuration GetConfiguration() { var dbServer = "localhost"; var dbUsername = "root"; var dbName = "nhibernate"; var dbPassword = ""; var ormAssembly = "NHibernate_MySQL.Domain"; var config = Fluently.Configure() .Database(MySQLConfiguration .Standard .ConnectionString(cs => cs .Server(dbServer) .Database(dbName) .Username(dbUsername) .Password(dbPassword))) .Mappings( x => x

How to map Dictionary<enum1,enum2> with Fluent Nhibernate

▼魔方 西西 提交于 2019-12-08 08:43:14
问题 I was mapping a relation using something like the following <map name="Foo" cascade="all-delete-orphan" lazy="false"> <key column="FooId"/> <index column="FooType" type="Domain.Enum.FooType, Domain"/> <element column ="FooStatus" type="Domain.Enum.FooStatus, Domain"/> </map> The class is like this namespace Domain { public class Enum { public enum FooType { Foo1, Foo2, ... Foo50} public enum FooStatus { NotNeeded, NeededFor1, NeededFor2, NeededFor3, NiceToHave} } } Can I do this using Fluent