Search Results

Search found 13331 results on 534 pages for 'fluent interface'.

Page 5/534 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Subclass of Subclass fluent nHibernate

    - by Xavier Hayoz
    Hi all My model looks like this: public class SelectionItem : BaseEntity // BaseEntity ==> id, timestamp stuff {//blabla} public class Size : SelectionItem {//blabla} public class Adultsize : Size {//blabla} I would like to use class-hierarchy-per-table-method of fluent nhibernate public class SelectionItemMap : BaseEntityMap<Entities.SelectionItem.SelectionItem> { public SelectionItemMap() { Map(x => x.Name); Map(x => x.Picture); Map(x => x.Code); DiscriminateSubClassesOnColumn("SelectionItemType"); } } and reset a DiscriminateSubClassesOnColumn on the following subclass: public class SizeMap : SubclassMap<Size> { DiscriminateSubClassesOnColumn("SizeType") } public Adultsize : SubclassMap<Adultsize> {} But this doesn't work. I found a solution on the web: link text but this method is depreciated according to resharper. How to solve it? thank you for further informations.

    Read the article

  • Mapping table and a simple view with Fluent NHibernate

    - by adrin
    I have mapped a simple entity, let's say an invoice using Fluent NHibernate, everything works fine... after a while it turns out that very frequently i need to process 'sent invoices' (by sent invoices we mean all entities that fulfill invoice.sent==true condition)... is there a way to easily abstract 'sent invoices' in terms of my data access layer? I dont like the idea of having aforementioned condition repeated in half of my repository methods. I thought that using a simple filtering view would be optimal, but how could it be done? Maybe I am doing it terribly wrong and someone would help me realize it :)?

    Read the article

  • Combining a one-to-one relationship into one object in Fluent NHibernate

    - by Mike C.
    I have a one-to-one relationship in my database, and I'd like to just combine that into one object in Fluent NHibernate. The specific tables I am talking about are the aspnet_Users and aspnet_Membership tables from the default ASP.NET Membership implementation. I'd like to combine those into one simple User object and only get the fields I want. I would also like to make this read-only, as I want to use the built-in ASP.NET Membership API to modify. I simply want to take advantage of lazy-loading. Any help would be appreciated. Thanks!

    Read the article

  • How do I get fluent nhibernate to create a varbinary(max) field in sql server

    - by czk
    Hi, How can I get fluent nhibernate to create a varbinary field in a sql server 2005 table that uses a field size of varbinary(max)? At the moment I always get a default of varbinary(8000), which isn't big enough as i'm going to be storing image files. I've tried using CAstle.ActiveRecord but havent had any success yet. [ActiveRecord] public class MyFile : Entity { public virtual string FileName { get; set; } public virtual string FileType { get; set; } public virtual int FileVersion { get; set; } public virtual int FileLength { get; set; } [Property(ColumnType = "BinaryBlob", SqlType = "VARBINARY(MAX)")] public virtual byte[] FileData { get; set; } } Been failing at finding a solution for hours now, so thanks in advance czk

    Read the article

  • Validate a single property with the Fluent Validation Library for .Net

    - by Blegger
    Can you validate just a single property with the Fluent Validation Library, and if so how? I thought this discussion thread from January of 2009 showed me how to do it via the following syntax: validator.Validate(new Person(), x => x.Surname); Unfortunately it doesn't appear this works in the current version of the library. One other thing that led me to believe that validating a single property might be possible is the following quote from Jeremy Skinners' blog post: "Finally, I added the ability to be able to execute some of FluentValidation’s Property Validators without needing to validate the entire object. This means it is now possible to stop the default “A value was required” message from being added to ModelState. " However I do not know if that necessarily means it supports just validating a single property or the fact that you can tell the validation library to stop validating after the first validation error.

    Read the article

  • fluent nhibernate m-to-m with column

    - by csetzkorn
    Hi, I am used to hbm files and started using fluent nhibernate recently. Creating an m-to-m relationship between two entities A and B is quite simple In A I create: public virtual IList Bs { get; set; } and then I use: mapping.HasManyToMany(x = x.Bs); That’s it and I can do: A a = new A(); a.Bs.Add(b); My problem is that I would like to have an additional column in my dedicated m-to-m database table which holds the two foreign keys. What is the simplest way to achieve this in FNH? Would I have to create a dedicated entity for the m-to-m realtionship or is there a simpler solution? Thanks. Best wishes, Christian

    Read the article

  • Fluent Nhibernate Automap convention for not-null field

    - by user215015
    Hi, Could some one help, how would I instruct automap to have not-null for a cloumn? public class Paper : Entity { public Paper() { } [DomainSignature] [NotNull, NotEmpty] public virtual string ReferenceNumber { get; set; } [NotNull] public virtual Int32 SessionWeek { get; set; } } But I am getting the following: <column name="SessionWeek"/> I know it can be done using fluent-map. but i would like to know it in auto-mapping way. Many thanks. Regards Robie

    Read the article

  • Cascade Saves with Fluent NHibernate AutoMapping

    - by Ryan Montgomery
    How do I "turn on" cascading saves using AutoMap Persistence Model with Fluent NHibernate? As in: I Save the Person and the Arm should also be saved. Currently I get "object references an unsaved transient instance - save the transient instance before flushing" public class Person : DomainEntity { public virtual Arm LeftArm { get; set; } } public class Arm : DomainEntity { public virtual int Size { get; set; } } I found an article on this topic, but it seems to be outdated.

    Read the article

  • How to setup fluent nhibernate to work with Fitnesse

    - by Toran Billups
    I'm currently using fluent nhibernate and can't seem to get the configuration to work when using Fitnesse. For starters I have a FitServer.exe.config that looks like the below <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings file='C:\projectpath\web.config' /> </configuration> Then inside my web.config I have a connection string defined But will Fitnesse work when I use the following config? (using the ConnectionString config) private static ISessionFactory CreateSessionFactory() { var cfg = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString(c => c.FromConnectionStringWithKey("Local"))) .Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly())) .ExposeConfiguration(x => x.SetProperty("current_session_context_class", "thread")); return cfg.BuildSessionFactory(); }

    Read the article

  • No persister for: <ClassName> issue with Fluent NHibernate

    - by Amit
    I have following code: //AutoMapConfig.cs using System; using FluentNHibernate.Automapping; namespace SimpleFNH.AutoMap { public class AutoMapConfig : DefaultAutomappingConfiguration { public override bool ShouldMap(Type type) { return type.Namespace == "Examples.FirstAutomappedProject.Entities"; } } } //CascadeConvention.cs using FluentNHibernate.Conventions; using FluentNHibernate.Conventions.Instances; namespace SimpleFNH.AutoMap { public class CascadeConvention : IReferenceConvention, IHasManyConvention, IHasManyToManyConvention { public void Apply(IManyToOneInstance instance) { instance.Cascade.All(); } public void Apply(IOneToManyCollectionInstance instance) { instance.Cascade.All(); } public void Apply(IManyToManyCollectionInstance instance) { instance.Cascade.All(); } } } //Item.cs namespace SimpleFNH.Entities { public class Item { public virtual long ID { get; set; } public virtual string ItemName { get; set; } public virtual string Description { get; set; } public virtual OrderItem OrderItem { get; set; } } } //OrderItem.cs namespace SimpleFNH.Entities { public class OrderItem { public virtual long ID { get; set; } public virtual int Quantity { get; set; } public virtual Item Item { get; set; } public virtual ProductOrder ProductOrder { get; set; } public virtual void AddItem(Item item) { item.OrderItem = this; } } } using System; using System.Collections.Generic; //ProductOrder.cs namespace SimpleFNH.Entities { public class ProductOrder { public virtual long ID { get; set; } public virtual DateTime OrderDate { get; set; } public virtual string CustomerName { get; set; } public virtual IList<OrderItem> OrderItems { get; set; } public ProductOrder() { OrderItems = new List<OrderItem>(); } public virtual void AddOrderItems(params OrderItem[] items) { foreach (var item in items) { OrderItems.Add(item); item.ProductOrder = this; } } } } //NHibernateRepo.cs using FluentNHibernate.Cfg; using FluentNHibernate.Cfg.Db; using NHibernate; using NHibernate.Criterion; using NHibernate.Tool.hbm2ddl; namespace SimpleFNH.Repository { public class NHibernateRepo { private static ISessionFactory _sessionFactory; private static ISessionFactory SessionFactory { get { if (_sessionFactory == null) InitializeSessionFactory(); return _sessionFactory; } } private static void InitializeSessionFactory() { _sessionFactory = Fluently.Configure().Database( MsSqlConfiguration.MsSql2008.ConnectionString( @"server=Amit-PC\SQLEXPRESS;database=SimpleFNH;Trusted_Connection=True;").ShowSql()). Mappings(m => m.FluentMappings.AddFromAssemblyOf<Order>()).ExposeConfiguration( cfg => new SchemaExport(cfg).Create(true, true)).BuildSessionFactory(); } public static ISession OpenSession() { return SessionFactory.OpenSession(); } } } //Program.cs using System; using System.Collections.Generic; using System.Linq; using SimpleFNH.Entities; using SimpleFNH.Repository; namespace SimpleFNH { class Program { static void Main(string[] args) { using (var session = NHibernateRepo.OpenSession()) { using (var transaction = session.BeginTransaction()) { var item1 = new Item { ItemName = "item 1", Description = "test 1" }; var item2 = new Item { ItemName = "item 2", Description = "test 2" }; var item3 = new Item { ItemName = "item 3", Description = "test 3" }; var orderItem1 = new OrderItem { Item = item1, Quantity = 2 }; var orderItem2 = new OrderItem { Item = item2, Quantity = 4 }; var orderItem3 = new OrderItem { Item = item3, Quantity = 5 }; var productOrder = new ProductOrder { CustomerName = "Amit", OrderDate = DateTime.Now, OrderItems = new List<OrderItem> { orderItem1, orderItem2, orderItem3 } }; productOrder.AddOrderItems(orderItem1, orderItem2, orderItem3); session.Save(productOrder); transaction.Commit(); } } using (var session = NHibernateRepo.OpenSession()) { // retreive all stores and display them using (session.BeginTransaction()) { var orders = session.CreateCriteria(typeof(ProductOrder)) .List<ProductOrder>(); foreach (var item in orders) { Console.WriteLine(item.OrderItems.First().Quantity); } } } } } } I tried many variations to get it working but i get an error saying No persister for: SimpleFNH.Entities.ProductOrder Can someone help me get it working? I wanted to create a simple program which will set a pattern for my bigger project but it is taking quite a lot of time than expected. It would be rally helpful if you can explain in simple terms on any template/pattern that i can use to get fluent nHibernate working. The above code uses auto mapping, which i tried after i tried with fluent mapping.

    Read the article

  • Using Fluent NHibernate with Castle Windsor and the NHibernate Facility

    - by Andrew
    Ive managed to get Fluent NHibernate 1.1 playing nicely with Castle Windsor 2.1. This involved me recompiling NHibernate.ByteCode.Castle.dll and it all works fine. Ive managed to do the same thing this time with Castle Windsor 2.5, havent tried it yet but its not complaining which is good enough for me at the moment. However Im also using the Castle NHibernate Facility and that is another story. The version of the NHibernate Facility that is compatible with Castle 2.5 requires a much later version of NHibernate. Is there an easy way to get the NHibernate Facility to work with NHibernate 2.1 and Castle Core 2.5?

    Read the article

  • Parent Child Relationships with Fluent NHibernate?

    - by ElHaix
    I would like to create a cascading tree/list of N number of children for a given parent, where a child can also become a parent. Given the following data structure: CountryType=1; ColorType=3; StateType=5 6,7,8 = {Can, US, Mex} 10, 11, 12 = {Red, White, Blue} 20,21,22= {California, Florida, Alberta} TreeID ListTypeID ParentTreeID ListItemID 1 1 Null 6 (Canada is a Country) 2 1 Null 7 (US is a Country) 3 1 Null 8 (Mexico is a Country) 4 3 3 10 (Mexico has Red) 5 3 3 11 (Mexico has White) 6 5 1 22 (Alberta is in Canada) 7 5 7 20 (California is in US) 8 5 7 21 (Florida is in US) 9 3 6 10 (Alberta is Red) 10 3 6 12 (Alberta is Blue) 11 3 2 10 (US is Red) 12 3 2 11 (Us is Blue) How would this be represented in Fluent NHibernate classes? Some direction would be appreciated. Thanks.

    Read the article

  • Mapping child objects in fluent nhibernate to a read-only view

    - by grenade
    Given that I am implementing a read-only UI, how do I create a ClassMap for Shop: public class Shop { public int Id { get; set; } public City City { get; set; } } public class City { public string Name { get; set; } public string CountryCode { get; set; } } The DB interface for Shops is a View containing 3 columns (ShopId, CityName, CountryCode). I was hoping to do something like this: public sealed class ShopMap : ClassMap<Shop> { public ShopMap() { Table("Shop"); Id(x => x.Id, "ShopId"); Map(x => x.City.Name, "CityName"); Map(x => x.City.CountryCode, "CountryCode"); } } Will fluent auto-instantiate Shop.City?

    Read the article

  • Fluent many-to-many: Deleting one end does not remove the entry in the relation table

    - by Kristoffer
    I have two classes (Parent, Child) that have a many-to-many relationship that only one end (Parent) knows about. My problem is that when I delete a "relation unaware" object (Child), the record in the many-to-many table is left. I want the relationship to be removed regardless of which end of it is deleted. How can I do that with Fluent NHibernate mappings, without adding a Parent property on Child? The classes: public class Parent { public Guid Id { get; set; } public IList<Child> Children { get; set; } } public class Child { public Guid Id { get; set; } // Don't want the property below: // public Parent Parent { get; set; } }

    Read the article

  • How to debug Fluent nHibernate

    - by Matt Thrower
    Hi, I'm having some trouble with Fluent nHibernate. I added a column to a table and I thought I'd correctly changed the mappings and the connected data objects to correctly reflect this. However when I tried to run my application again I kept getting this error: System.Data.SqlClient.SqlException: Invalid column name 'Workflow_id'. I really couldn't see what the problem was with the changes I'd made so I reverted back to the original versions of the mapping and data object files from source control and removed the offending column from the database. But I'm still getting the same error. I'd like some advice on how to debug this. The SQL that gets reported on the error is semi-nonsensical: SELECT regions0_.Page_id as Page5_1_, regions0_.Id as Id1_, regions0_.Id as Id27_0_, regions0_.RegionId as RegionId27_0_, regions0_.RegionTemplate_id as RegionTe3_27_0_, regions0_.Workflow_id as Workflow4_27_0_ FROM [Region] regions0_ WHERE regions0_.Page_id=? And it won't execute as valid SQL anyway. Any ideas as to where to go from here?

    Read the article

  • mapping 'value object' collection in (Fluent) NHibernate

    - by adrin
    I have the following entity public class Employee { public virtual int Id {get;set;} public virtual ISet<Hour> XboxBreakHours{get;set} public virtual ISet<Hour> CoffeeBreakHours {get;set} } public class Hour { public DateTime Time {get;set;} } (What I want to do here is store information that employee A plays Xbox everyday let's say at 9:00 13:30 and has a coffee break everyday at 7:00 12:30 18:00) - I am not sure if my approach is valid at all here. The question is how should my (ideally fluent) mappings look like here? It is not necessary (from my point of view) for Hour class to have Id or be accessible from some kind of repository.

    Read the article

  • Fluent NHibernate ExportSchema without connexion string

    - by Vince
    Hi all, I want to propose to user a way to generate database table script creation. To do this for now i use NHibernate ExportSchema bases on a NHibernate configuration generated with Fluent NHibernate this way (during my ISessionFactory creation method): FluentConfiguration configuration = Fluently.Configure(); ... Mapping conf ... configuration.Database(fluentDatabaseProvider); this.nhibernateConfiguration = configuration.BuildConfiguration(); returnSF = configuration.BuildSessionFactory(); ... Later new SchemaExport(this.nhibernateConfiguration) .SetOutputFile(filePath) .Execute(false, false, false); fluentDatabaseProvider is a FluentNHibernate IPersistenceConfigurer which is needed to get proper sql dialect for database creation. When factory is created with an existing database, everything works fine. But what i want to do is to create an NHibernate Configuration object on a selected database engine without a real database behind the scene... And i don't manage to do this. If anybody has some idea.

    Read the article

  • Programming to interfaces while mapping with Fluent NHibernate.

    - by Lucious
    Fluent Mapping I Have the following scenario public class CustomerMap : ClassMap { public CustomerMap() { Table("Customer"); Id(c = c.Id); Map(c = c.Name); HasMany(c = c.Orders); } } public class OrderMap : ClassMap<IOrder> { public OrderMap() { Table("Orders"); References(o => o.Customer).Access.; Id(o => o.Id); Map(o => o.DateCreated); } } Problems When schema exported the order table has two columns ICustomer_Id,Customer_Id. refers to an unmapped class Order exception Can you please help me out?

    Read the article

  • Juniper SSG-5 subinterface vlan routing to the internet

    - by catfish
    I'm unable to get a brand new Juniper SSG-5 with latest 6.3.0r05 firmware routing to the internet from a subinterface I created on bgroup0 setup as vlan2 (bgroup0.1 on "wifi" zone). When connected on the default vlan it gets on the internet just fine. When I switch to vlan2 I'm unable to get to the internet. I am able to get the correct ip address (10.150.0.0/24) from dhcp, able to get to the juniper management page, etc but nothing past the firewall, can't ping 4.2.2.2 or the internet gateway. Even setting up logging on the wifi-to-untrust policy and it does shows the attempts (it's it's timeouts). 172.31.16.0/24 is the untrusted lan, it's already nat'ed but works fine for testing. Can ping this ip from the default vlan but not from vlan2 192.168.1.0/24 is the trusted main lan 10.150.0.0/24 is the wifi isolated lan on vlan2 The idea is to setup an AP with lan and guest access (AP supports multiple ssid's on different vlans). I know I can setup the juniper to use different ports for the wifi lan and use their procurve switch to do the vlan separation, but I never used vlan'ing on a Juniper firewall and I would like to try it out this way. Here is the complete config file: unset key protection enable set clock timezone -5 set vrouter trust-vr sharable set vrouter "untrust-vr" exit set vrouter "trust-vr" unset auto-route-export exit set alg appleichat enable unset alg appleichat re-assembly enable set alg sctp enable set auth-server "Local" id 0 set auth-server "Local" server-name "Local" set auth default auth server "Local" set auth radius accounting port 1646 set admin name "netscreen" set admin password "xxxxxxxxxxxxxxxx" set admin auth web timeout 10 set admin auth dial-in timeout 3 set admin auth server "Local" set admin format dos set zone "Trust" vrouter "trust-vr" set zone "Untrust" vrouter "trust-vr" set zone "DMZ" vrouter "trust-vr" set zone "VLAN" vrouter "trust-vr" set zone id 100 "Wifi" set zone "Untrust-Tun" vrouter "trust-vr" set zone "Trust" tcp-rst set zone "Untrust" block unset zone "Untrust" tcp-rst set zone "MGT" block unset zone "V1-Trust" tcp-rst unset zone "V1-Untrust" tcp-rst set zone "DMZ" tcp-rst unset zone "V1-DMZ" tcp-rst unset zone "VLAN" tcp-rst unset zone "Wifi" tcp-rst set zone "Untrust" screen tear-drop set zone "Untrust" screen syn-flood set zone "Untrust" screen ping-death set zone "Untrust" screen ip-filter-src set zone "Untrust" screen land set zone "V1-Untrust" screen tear-drop set zone "V1-Untrust" screen syn-flood set zone "V1-Untrust" screen ping-death set zone "V1-Untrust" screen ip-filter-src set zone "V1-Untrust" screen land set interface "ethernet0/0" zone "Untrust" set interface "ethernet0/1" zone "Untrust" set interface "bgroup0" zone "Trust" set interface "bgroup0.1" tag 2 zone "Wifi" set interface "bgroup1" zone "DMZ" set interface bgroup0 port ethernet0/2 set interface bgroup0 port ethernet0/3 set interface bgroup0 port ethernet0/4 set interface bgroup0 port ethernet0/5 set interface bgroup0 port ethernet0/6 unset interface vlan1 ip set interface ethernet0/0 ip 172.31.16.243/24 set interface ethernet0/0 route set interface bgroup0 ip 192.168.1.1/24 set interface bgroup0 nat set interface bgroup0.1 ip 10.150.0.1/24 set interface bgroup0.1 nat set interface bgroup0.1 mtu 1500 unset interface vlan1 bypass-others-ipsec unset interface vlan1 bypass-non-ip set interface ethernet0/0 ip manageable set interface bgroup0 ip manageable set interface bgroup0.1 ip manageable set interface ethernet0/0 manage ping set interface ethernet0/1 manage ping set interface bgroup0.1 manage ping set interface bgroup0.1 manage telnet set interface bgroup0.1 manage web unset interface bgroup1 manage ping set interface bgroup0 dhcp server service set interface bgroup0.1 dhcp server service set interface bgroup0 dhcp server auto set interface bgroup0.1 dhcp server enable set interface bgroup0 dhcp server option gateway 192.168.1.1 set interface bgroup0 dhcp server option netmask 255.255.255.0 set interface bgroup0 dhcp server option dns1 8.8.8.8 set interface bgroup0.1 dhcp server option lease 1440 set interface bgroup0.1 dhcp server option gateway 10.150.0.1 set interface bgroup0.1 dhcp server option netmask 255.255.255.0 set interface bgroup0.1 dhcp server option dns1 8.8.8.8 set interface bgroup0 dhcp server ip 192.168.1.33 to 192.168.1.126 set interface bgroup0.1 dhcp server ip 10.150.0.50 to 10.150.0.100 unset interface bgroup0 dhcp server config next-server-ip unset interface bgroup0.1 dhcp server config next-server-ip set interface "serial0/0" modem settings "USR" init "AT&F" set interface "serial0/0" modem settings "USR" active set interface "serial0/0" modem speed 115200 set interface "serial0/0" modem retry 3 set interface "serial0/0" modem interval 10 set interface "serial0/0" modem idle-time 10 set flow tcp-mss unset flow no-tcp-seq-check set flow tcp-syn-check unset flow tcp-syn-bit-check set flow reverse-route clear-text prefer set flow reverse-route tunnel always set pki authority default scep mode "auto" set pki x509 default cert-path partial set crypto-policy exit set ike respond-bad-spi 1 set ike ikev2 ike-sa-soft-lifetime 60 unset ike ikeid-enumeration unset ike dos-protection unset ipsec access-session enable set ipsec access-session maximum 5000 set ipsec access-session upper-threshold 0 set ipsec access-session lower-threshold 0 set ipsec access-session dead-p2-sa-timeout 0 unset ipsec access-session log-error unset ipsec access-session info-exch-connected unset ipsec access-session use-error-log set url protocol websense exit set policy id 1 from "Trust" to "Untrust" "Any" "Any" "ANY" permit set policy id 1 exit set policy id 2 from "Wifi" to "Untrust" "Any" "Any" "ANY" permit log set policy id 2 exit set nsmgmt bulkcli reboot-timeout 60 set ssh version v2 set config lock timeout 5 unset license-key auto-update set telnet client enable set snmp port listen 161 set snmp port trap 162 set snmpv3 local-engine id "0162122009006149" set vrouter "untrust-vr" exit set vrouter "trust-vr" unset add-default-route set route 0.0.0.0/0 interface ethernet0/0 gateway 172.31.16.1 exit set vrouter "untrust-vr" exit set vrouter "trust-vr" exit

    Read the article

  • Named query not known error trying to call a stored proc using Fluent NHibernate

    - by Hamman359
    I'm working on setting up NHibernate for a project and I have a few queries that, due to their complexity, we will be leaving as stored procedures. I'd like to be able to use NHibernate to call the sprocs, but have run into an error I can't figure out. Since I'm using Fluent NHibernate I'm using mixed mode mapping as recommended here. However, when I run the app I get a "Named query not known: AccountsGetSingle" exception and I can't figure out why. I think I might have a problem with my HBM mapping since I'm not very familiar with using them but I'm not sure. My NHibernate configuration code is: private ISessionFactory CreateSessionFactory() { return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005 .ConnectionString((conn => conn.FromConnectionStringWithKey("CIDB"))) .ShowSql()) .Mappings(m => { m.HbmMappings.AddFromAssemblyOf<Account>(); m.FluentMappings.AddFromAssemblyOf<Account>(); }) .BuildSessionFactory(); } My hbm.xml file is: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <sql-query name="AccountsGetSingle"> <return alias="Account" class="Core, Account"></return> exec AccountsGetSingle </sql-query> </hibernate-mapping> And the code where I am calling the sproc looks like this: public Account Get() { return _conversation.Session .GetNamedQuery("AccountsGetSingle") .UniqueResult<Account>(); } Any thoughts or ideas would be appreciated. Thanks.

    Read the article

  • how to map SubclassMap and HasManyToMany in Fluent NHibernate

    - by Davide Orazio Montersino
    Hi everyone. My problem is fluent nhibernate mapping a many to many relationship, they end up referencing a non existent Id. public UserMap() { Id(x => x.Id); Map(x => x.Name); Map(x => x.Password); Map(x => x.Confirmed); HasMany(x => x.Nodes).Cascade.SaveUpdate(); HasManyToMany<Node>(x => x.Events).Cascade.SaveUpdate().Table("RSVPs"); } public EventMap() { Map(x => x.Starts); Map(x => x.Ends); HasManyToMany<User>(x => x.Rsvps).Cascade.SaveUpdate().Table("RSVPs"); } public NodeMap() { Id(x => x.Id); Map(x => x.Title); Map(x => x.Body).CustomSqlType("text"); Map(x => x.CreationDate); References(x => x.Author).Cascade.SaveUpdate(); Map(x => x.Permalink).Unique().Not.Nullable(); } Those are my classes -notice that Event inherits from Node: public class Event : Node//, IEvent { private DateTime _starts = DateTime.MinValue; private DateTime _ends = DateTime.MaxValue; public virtual IList<User> Rsvps { get; set; } } The problem is, the generated RSVPs table is like that: Event_id User_id Node_id Of course the Event table has no ID - only a Node_id. When trying to save a relationship it will try to save a NULL event_id thus generating an error.

    Read the article

  • How to configure cache regions in fluent nhibernate and syscache2

    - by Marcus Oldin
    Hi, I've been trying to implement cache regions with fluent nhibernate and I've done the following so far: Setup caching in Fluently.Configure(): private static ISessionFactory CreateSessionFactory() { string csStringName = Environment.MachineName; var nhibConfigProps = new Dictionary&lt;string, string&gt;(); nhibConfigProps.Add("current_session_context_class","web"); var cfg = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString(c =&gt; c.FromConnectionStringWithKey(csStringName)) .ShowSql() .Cache(cache=&gt;cache.ProviderClass&lt;NHibernate.Caches.SysCache2.SysCacheProvider&gt;().UseQueryCache())) .Mappings(m =&gt; m.FluentMappings.AddFromAssemblyOf&lt;UserMap&gt;()) .ExposeConfiguration(config =&gt; config.AddProperties(nhibConfigProps)) .ExposeConfiguration(config=&gt; config.EventListeners.DeleteEventListeners = new IDeleteEventListener[] {new SoftDeleteListener()}) .ExposeConfiguration(config =&gt; new SchemaUpdate(config).Execute(false, true)) .BuildSessionFactory(); return cfg; } Changed my ClassMap to enable cache, and set the region of choice: public UserMap() { Cache.ReadWrite().Region("User"); ... } Hopefully I've done the above correctly, but I can't really figure out where to configure the priority and cache duration for each region. Do you know how to do that? And if you happen to find flaws in the above code I'd really appreciate the feedback. TIA//Marcus

    Read the article

  • "The name 'WithTable' does not exist in the current context" using Fluent NHibernate

    - by Byron Sommardahl
    Might be a really easy problem to fix, but it the solution is eluding me! I'm using Fluent NHibernate 1.0 RTM (and using NHibernate bins that ships with it). I'm trying to map my entities and cannot use the WithTable() method. It's not available in Intelligence and VS doesn't suggest any namespaces to reference. Here's my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using GeoCodeThe.Net.Domain.Entities; using FluentNHibernate.Mapping; namespace GeoCodeThe.Net.Domain.Mappings { class CategoryMap: ClassMap<ICategory> { public CategoryMap() { WithTable("Categories"); // <----- Compile error: The name 'WithTable' does not exist in the current context Id(x => x.Id); Map(x => x.Name); Map(x => x.Tags); } } My bin folder has: Antlr3.Runtime.dll Castle.Core.dll Castle.DynamicProxy2.dll FluentNHibernate.dll Iesi.Collections.dll log4net.dll NHibernate.ByteCode.Castle.dll NHibernate.dll FluentNHibernate.pdb Castle.Core.xml Castle.DynamicProxy2.xml FluentNHibernate.xml Iesi.Collections.xml log4net.xml NHibernate.ByteCode.Castle.xml NHibernate.xml Any clue what I'm missing? Let me know if you need any more clarification.

    Read the article

  • Fluent NHibernate, dynamically change Table of mapping?

    - by Steffen
    Hello, with fluent nhibernate, is there a way to dynamically switch the table of a mapping at runtime? For example: public class XYClassMap : ClassMap<XY> { public XYClassMap( ) { Table("XYTable"); Id(d => d.Id).GeneratedBy.Identity(); Map(d => d.Value); (...) Given that there are multiple plugins, each of them uses this one class, but they need to work with different tables. I am looking for something like this: public class XY { public string Tablename {get; set;} } public class XYClassMap : ClassMap<XY> { public XYClassMap( ) { Table(Tablename); Id(d => d.Id).GeneratedBy.Identity(); Map(d => d.Value); (...) So every action method could work with the same class and only would need to set this one property "Tablename". Thanks for any help, Steffen

    Read the article

  • Fluent NHibernate IDictionary with composite element mapping

    - by Alessandro Di Lello
    Hi there, i have these 2 classes: public class Category { IDictionary<string, CategoryResorce> _resources; } public class CategoryResource { public virtual string Name { get; set; } public virtual string Description { get; set; } } and this is xml mapping <class name="Category" table="Categories"> <id name="ID"> <generator class="identity"/> </id> <map name="Resources" table="CategoriesResources" lazy="false"> <key column="EntityID" /> <index column="LangCode" type="string"/> <composite-element class="Aca3.Models.Resources.CategoryResource"> <property name="Name" column="Name" /> <property name="Description" column="Description"/> </composite-element> </map> </class> and i'd like to write it with Fluent. I found something similar and i was trying with this code: HasMany(x => x.Resources) .AsMap<string>("LangCode") .AsIndexedCollection<string>("LangCode", c => c.GetIndexMapping()) .Cascade.All() .KeyColumn("EntityID"); but i dont know how to map the CategoryResource entity as a composite element inside the Category element. Any advice ? thanks

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >