Search Results

Search found 744 results on 30 pages for 'fluent'.

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

  • Easily Setup Fluent Nhibernate With Oracle

    Nowadays it is preferred to use ORM instead of old data access approaches. However, setting up an ORM like Fluent NHibernate with Oracle takes some time. With the help of NuGet you can setup such third party tools in no time. In this article I am going to to show how you can easily configure Fluent NHibernate with Oracle using NuGet. Moreover, the article will guide you in building a generic repository using Fluent NHibernate.

    Read the article

  • Fluent NHibernate Automap does not take into account IList<T> collections as indexed

    - by Francisco Lozano
    I am using automap to map a domain model (simplified version): public class AppUser : Entity { [Required] public virtual string NickName { get; set; } [Required] [DataType(DataType.Password)] public virtual string PassKey { get; set; } [Required] [DataType(DataType.EmailAddress)] public virtual string EmailAddress { get; set; } public virtual IList<PreferencesDescription> PreferencesDescriptions { get; set; } } public class PreferencesDescription : Entity { public virtual AppUser AppUser { get; set; } public virtual string Content{ get; set; } } The PreferencesDescriptions collection is mapped as an IList, so is an indexed collection (when I require standard unindexed collections I use ICollection). The fact is that fluent nhibernate's automap facilities map my domain model as an unindexed collection (so there's no "position" property in the DDL generated by SchemaExport). ¿How can I make it without having to override this very case - I mean, how can I make Fluent nhibernate's automap make always indexed collections for IList but not for ICollection

    Read the article

  • How to make Fluent NHibernate ignore Dictionary properties

    - by Matt Winckler
    I'm trying to make Fluent NHibernate's automapping ignore a Dictionary property on one of my classes, but Fluent is ignoring me instead. Ignoring other types of properties seems to work fine, but even after following the documentation and adding an override for the Dictionary, I still get the following exception when BuildSessionFactory is called: The type or method has 2 generic parameter(s), but 1 generic argument(s) were provided. A generic argument must be provided for each generic parameter. I've tried overriding by property name: .Override<MyClass>(map => { map.IgnoreProperty(x => x.MyDictionaryProperty); }) and also tried implementing ignores using a custom attribute, both of which result in the same exception from BuildSessionFactory. The only thing so far that makes this exception go away is removing the Dictionary property entirely. My question seems to be identical to this one which was never answered (though I'll expand the scope by stating it doesn't matter whether the dictionary is on an abstract base class; the problem always happens for me regardless of what class the property is on). Any takers this time around?

    Read the article

  • SqlLite/Fluent NHibernate integration test harness initialization not repeatable after large data se

    - by Mark Rogers
    In one of my main data integration test harnesses I create and use Fluent NHibernate's SingleConnectionSessionSourceForSQLiteInMemoryTesting, to get a fresh session for each test. After each test, I close the connection, session, and session factory, and throw out the nested StructureMap container they came from. This works for almost any simple data integration test I can think, including ones that utilize Fluent NHib's PersistenceSpecification object. When I test the application's lengthy database bootstrapping process, which creates and saves thousands of domain objects, I start seeing issues. It's not that the setup and tear down fails, in fact, the test successfully bootstraps the in-memory database as the application would bootstrap the real database in the production environment. The problem occurs when the database bootstrapping occurs a second time on a new in-memory database, with a new session and session factory. The error is: NHibernate.StaleStateException : Unexpected row count: 0; expected: 1 The row count is indeed Unexpected, the row that the application under test is looking for should be in the session. You see, it's not that any data from the last integration test is sticking around, it's that for some reason the session just stops working mid-database-boostrap. And I've looked everywhere for a place I might be holding on to an old session and I can't find one. I've searched through the code for static singleton objects, but there are none anywhere near the code in question. I have a couple StructureMap InstanceScope singleton's but they are getting thrown out with each nested container that is lost after every test teardown. I've tried every possible variation on disposing and closing every object involved with each test teardown and it still fails on this lengthy database bootstrap. But non-bootstrap related database tests appear to work fine. I'm starting to run out of options and may have to surrender lengthy database integration tests in favor of WatiN-based acceptance tests. Can anyone give me any clue about how I can figure out why some of my SingleConnectionSessionSourceForSQLiteInMemoryTesting aren't repeatable? Any advice at all, about how to make an NHibernate SqlLite database integration test harness repeatable?

    Read the article

  • How to identify a particular entity's Session Factory with Fluent NHibernate and Multiple Databases

    - by Trevor
    I've already asked this question as part of an answer to another question ( see http://stackoverflow.com/questions/2655861/fluent-nhibernate-multiple-databases ) but thought it better to ask again here. My problem is this: I'm using Fluent NHibernate. My application uses multiple databases. Each database has its own entities registered (mapped) against it. The result is that have multiple Session Factories, each one relating to a single DB, and each 'containing' its own set of mapped entities. For loading entities I've created a generic Factory class that provides some standard load methods usable for any registered entity (in any DB). The problem is: The load methods need to use the correct session factory for the entity class I'm busy dealing with. How would I determine which session factory I need to use? I have all the Session Factories 'on hand' (and indexed by database name), I just need a way, knowing just the type of Entity I'm about to load, of choosing the right Session Factory to use. For example: public IBaseBusinessObject CreatePopulatedInstance(Type boType, Guid instanceKey) { IBaseBusinessObject result = null; ISessionFactory sessionFactory = GetSessionFactory(boType); using (ISession session = sessionFactory.OpenSession()) { using (session.BeginTransaction()) { result = (IBaseBusinessObject)session.Get(boType, instanceKey); } } return result; } What needs to go on in GetSessionFactory(boType) ? Thanks for reading!

    Read the article

  • Fluent NHibernate mapping List<Point> as value to single column

    - by Paja
    I have this class: public class MyEntity { public virtual int Id { get; set; } public virtual List<Point> Vectors { get; set; } } How can I map the Vectors in Fluent NHibernate to a single column (as value)? I was thinking of this: public class Vectors : ISerializable { public List<Point> Vectors { get; set; } /* Here goes ISerializable implementation */ } public class MyEntity { public virtual int Id { get; set; } public virtual Vectors Vectors { get; set; } } Is it possible to map the Vectors like this, hoping that Fluent NHibernate will initialize Vectors class as standard ISerializable? Or how else could I map List<Point> to a single column? I guess I will have to write the serialization/deserialization routines myself, which is not a problem, I just need to tell FNH to use those routines. I guess I should use IUserType or ICompositeUserType, but I have no idea how to implement them, and how to tell FNH to cooperate.

    Read the article

  • Mapping enum with fluent nhibernate

    - by Puneet
    I am following the http://wiki.fluentnhibernate.org/Getting%5Fstarted tutorial to create my first NHibernate project with Fluent NHibernate I have 2 tables 1) Account with fields Id AccountHolderName AccountTypeId 2) AccountType with fields Id AccountTypeName Right now the account types can be Savings or Current So the table AccountTypes stores 2 rows 1 - Savings 2 - Current For AccoutType table I have defined enum public enum AccountType { Savings=1, Current=2 } For Account table I define the entity class public class Account { public virtual int Id {get; private set;} public virtual string AccountHolderName {get; set;} public virtual string AccountType {get; set;} } The fluent nhibernate mappings are: public AgencyMap() { Id(o => o.Id); Map(o => o.AccountHolderName); Map(o => o.AccountType); } When I try to run the solution, it gives an exception - InnerException = {"(XmlDocument)(2,4): XML validation error: The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has incomplete content. List of possible elements expected: 'meta, subselect, cache, synchronize, comment, tuplizer, id, composite-id' in namespace 'ur... I guess that is because I have not speciofied any mapping for AccountType. The questions are: How can I use AccountType enum instead of a AccountType class? Maybe I am going on wrong track. Is there a better way to do this? Thanks!

    Read the article

  • Fluent NHibernate - Set reference key columns to null

    - by Matt
    Hi, I have a table of Appointments and a table of AppointmentOutcomes. On my Appointments table I have an OutcomeID field which has a foreign key to AppointmentOutcomes. My Fluent NHibernate mappings look as follows; Table("Appointments"); Not.LazyLoad(); Id(c => c.ID).GeneratedBy.Assigned(); Map(c => c.Subject); Map(c => c.StartTime); References(c => c.Outcome, "OutcomeID"); Table("AppointmentOutcomes"); Not.LazyLoad(); Id(c => c.ID).GeneratedBy.Assigned(); Map(c => c.Description); Using NHibernate, if I delete an AppointmentOutcome an exception is thrown because the foreign key is invalid. What I would like to happen is that deleting an AppointmentOutcome would automatically set the OutcomeID of any Appointments that reference the AppointmentOutcome to NULL. Is this possible using Fluent NHibernate?

    Read the article

  • Fluent NHibernate no data being returned

    - by czuroski
    Hello, I have been successfully using NHibernate, but now I am trying to move to Fluent NHibernate. I have created all of my mapping files and set up my session manager to use a Fluent Configuration. I then run my application and it runs successfully, but no data is returned. There are no errors or any indication that there is a problem, but nothing runs. when using NHibernate, if I don't set my hbm xml files as an embedded resource, this same thing happens. This makes me wonder what I have to set my Map classes to. Right now, they are just set to Compile, and they are compiled into the dll, which I can see by disassembling it. Does anyone have any thoughts as to what may be happening here? Thanks private ISessionFactory GetSessionFactory() { return Fluently.Configure() .Database( IfxOdbcConfiguration .Informix1000 .ConnectionString("Provider=Ifxoledbc.2;Password=mypass;Persist Security Info=True;User ID=myuser;Data Source=mysource") .Dialect<InformixDialect1000>() .ProxyFactoryFactory<ProxyFactoryFactory>() .Driver<OleDbDriver>() .ShowSql() ) .Mappings( m => m.FluentMappings .AddFromAssemblyOf<cmCase>() .AddFromAssemblyOf<attorney>() .AddFromAssemblyOf<creditor>() .AddFromAssemblyOf<party>() .AddFromAssemblyOf<person>() .AddFromAssemblyOf<sardbk>() .AddFromAssemblyOf<schedule>() //x => x.FluentMappings.AddFromAssembly(System.Reflection.Assembly.GetExecutingAssembly()) //.ExportTo("C:\\mappings") ) .BuildSessionFactory(); }

    Read the article

  • Fluent NHibernate join table mapping

    - by Rusty
    Reverse engineering an existing database to map with N-Hibernate using Fluent N-Hibernate. How can I map this? Address table Id Address1 Address2 Person table Id First Last Types Id TypeName PersonAddress table (A person can have home, business etc addresses) Id PersonId (Id from person table) AddressId (Id from address table) TypeId (Id from types lookup table HOME, BUSINESS etc..) Any help would be great. Thanks

    Read the article

  • Fluent NHibernate caching with automapping

    - by md1337
    I'm trying to understand how to configure Fluent NHibernate to enable 2nd-level caching for queries, entities, etc... There is very little information online on how to do that. I see it can be achieved by manually mapping the entities but I don't want that. I want to be able to cache all entities and not address the classes individually. How can I do that? Thanks.

    Read the article

  • Register an Interceptor with Castle Fluent Interface

    - by Quintin Par
    I am trying to implement nhibernate transaction handling through Interceptors and couldn’t figure out how to register the interface through fluent mechanism. I see a Component.For<ServicesInterceptor>().Interceptors but not sure how to use it. Can someone help me out? This example seemed a little complex.

    Read the article

  • Fluent interface and task based applications

    - by Mmarquee
    We have a number of applications that are now looking tired and a bit drab. Looking at the MS style fluent interface looks nice but seems (to me) to be more document based rather than task based. Is there a nice 'modern' ui style that lends itself to task based applications?

    Read the article

  • Fluent API Style Usage

    - by Chris Dwyer
    When programming against a fluent API, I've seen the style mostly like this: var obj = objectFactory.CreateObject() .SetObjectParameter(paramName, value) .SetObjectParameter(paramName, value) .DoSomeTransformation(); What is the reasoning behind putting the dot at the beginning of the line instead of the end of the line like this: var obj = objectFactory.CreateObject(). SetObjectParameter(paramName, value). SetObjectParameter(paramName, value). DoSomeTransformation(); Or, is it merely a style thing that a team makes a consensus on?

    Read the article

  • Fluent NHibernate question

    - by Kevin Pang
    Let's say you have two tables, "Users" and "UserRoles". Here's how the two tables are structured (table - columns): Users - UserID (int) UserRoles - UserID (int), Role (string) What I want is for my "User" class in my domain to have an IList of roles. How do I construct my Fluent NHibernate mapping to achieve this?

    Read the article

  • Primary Key Names in Fluent Nhibernate

    - by fregas
    Is there a way in fluent nhibernate (or possibly NHibernate in general) to tell it to generate the primary keys differently? It creates the column name for the key fine, but the index/constraint gets weird generated names like: PK_Address_3214EC2725332734 PK_CreditCa_3214EC2756CA82C8 etc... I can use straight sql to rename them but i'd rather not. thanks, all

    Read the article

  • method names with fluent interface

    - by deamon
    I have a Permissions class with methods in fluent style like this: somePermissions.setRead(true).setWrite(false).setExecute(true) The question is, whether I should name these methods set{Property} or only {property}. The latter would look like this: somePermissions.read(true).write(false).execute(true) If I look at these methods separately I would expect that read reads something, but on the other hand it is closer to the intention to have something like named paramaters like in Scala: Permission(read=true, write=false, execute=true)

    Read the article

  • SQLite connection pooling with Fluent NHibernate

    - by Groo
    Is there a way to setup SQLite connection pooling using Fluent NHibernate configuration? E.g. equivalent of DataSource=:memory: would be: var sessionFactory = Fluently .Configure() .Database(SQLiteConfiguration.Standard.InMemory) (etc.) Is there something eqivalent to "Pooling=True;Max Pool Size=1;"?

    Read the article

  • Make Fluent NHibernate output schema update to file

    - by Bender
    I am successfully getting Fluent NHibernate to update my database by calling UpdateBaseFiles: Public Sub UpdateBaseFiles() Dim db As SQLiteConfiguration db = SQLiteConfiguration.Standard.UsingFile(BASE_DBNAME) Fluently.Configure() _ .Database(db) _ .Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of FluentMap)()) _ .ExposeConfiguration(AddressOf UpdateSchema) _ .BuildConfiguration() End Sub Private Sub UpdateSchema(ByVal Config As Configuration) Dim SchemaUpdater As New SchemaUpdate(Config) SchemaUpdater.Execute(True, True) End Sub How do I output the DDL to a file, I do this when initially creating the schema by using: Private Sub BuildSchema(ByVal Config As Configuration) Dim SchemaExporter As New SchemaExport(Config) SchemaExporter.SetOutputFile("schema.sql") SchemaExporter.Create(False, True) End Sub but SchemaUpdate does not have a SetOutputFile method.

    Read the article

  • How to order a HasMany collection by a child property with Fluent NHibernate mapping

    - by Geoff Hardy
    I am using Fluent NHibernate to map the following classes: public abstract class DomainObject { public virtual int Id { get; protected internal set; } } public class Attribute { public virtual string Name { get; set; } } public class AttributeRule { public virtual Attribute Attribute { get; set; } public virtual Station Station { get; set; } public virtual RuleTypeId RuleTypeId { get; set; } } public class Station : DomainObject { public virtual IList<AttributeRule> AttributeRules { get; set; } public Station() { AttributeRules = new List<AttributeRule>(); } } My Fluent NHibernate mappings look like this: public class AttributeMap : ClassMap<Attribute> { public AttributeMap() { Id(o => o.Id); Map(o => o.Name); } } public class AttributeRuleMap : ClassMap<AttributeRule> { public AttributeRuleMap() { Id(o => o.Id); Map(o => o.RuleTypeId); References(o => o.Attribute).Fetch.Join(); References(o => o.Station); } } public class StationMap : ClassMap<Station> { public StationMap() { Id(o => o.Id); HasMany(o => o.AttributeRules).Inverse(); } } I would like to order the AttributeRules list on Station by the Attribute.Name property, but doing the following does not work: HasMany(o => o.AttributeRules).Inverse().OrderBy("Attribute.Name"); I have not found a way to do this yet in the mappings. I could create a IQuery or ICriteria to do this for me, but ideally I would just like to have the AttributeRules list sorted when I ask for it. Any advice on how to do this mapping?

    Read the article

  • Fluent Nhibernate Order-By on Collection

    - by madcapnmckay
    Hi, If I have a collection mapped in Fluent NHibernate and I want to apply an order to that collection how do I do that? Eg: HasMany(x => x.PastDates) .AsBag().Cascade .SaveUpdate() .KeyColumnNames.Add("EventId") .Where(e => e.DateFrom < DateTime.Now.Date) .Inverse(); I'm looking for the equivalent of the order-by attribute in HBM files. Thanks

    Read the article

  • ASP.NET MVC + fluent nNibernate, what IoC tool?

    - by bondehagen
    I'm working on a ASP.NET MVC project where we have decided to use Fluent nHibernate for dataccess. To enable loose coupling we go for a IoC/DI pattern. My questions is what IoC tool to go for. I've tried to find the differences between windsor, ninject, spring, structuremap and unity, but it's difficult to see the benefits each one has to offer. Whats your experience?

    Read the article

  • Where clause in Fluent NHibernate Many-to-Many

    - by Adam Albrecht
    I am trying to setup a many-to-many mapping in Fluent Nhibernate that has a where clause attached to the child table. This is basically how it should work: HasManyToMany(p => p.Images) .Table("ProductImages") .ParentKeyColumn("ProductID") .ChildKeyColumn("ImageID") .Where("ImageTypeID = 2"); The ImageTypeID column is in the Images table, but NHibernate is assuming it is part of the ProductImages table. Any idea how I can specify this? Thanks!

    Read the article

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