Search Results

Search found 1672 results on 67 pages for 'nhibernate'.

Page 28/67 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • 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

  • Recommendations for supporting both Oracle and MSSQL in the same ASP.NET app with NHibernate

    - by Hugo Zapata
    Our client wants to support both SQLServer and Oracle in the next project. Our experience comes from .NET/SQL Server platform. We will hire an Oracle developer, but our concern is with the DataAccess code. Will NHibernate make the DB Engine transparent for us? I don't think so, but i would like to hear from developers who have faced similar situations. I know this question is a little vague, because i don't have Oracle experience, so i don't know what issues we will find.

    Read the article

  • Phantom updates due to decimal precision on calculated properties

    - by Jamie Ide
    This article describes my problem. I have several properties that are calculated. These are typed as decimal(9,2) in SQL Server and decimal in my C# classes. An example of the problem is: Object is loaded with a property value of 14.9 A calculation is performed and the property value is changed to 14.90393 When the session is flushed, NHibernate issues an update because the property is dirty Since the database field is decimal (9,2) the stored value doesn't change Basically a phantom update is issued every time this object is loaded. I don't want to truncate the calculations in my business objects because that tightly couples them to the database and I don't want to lose the precision in other calculations. I tried setting scale and precision or CustomType("Decimal(9,2)") in the mapping file but this appears to only affect schema generation. My only reasonable option appears to be creating an IUserType implementation to handle this. Is there a better solution?

    Read the article

  • unit test service layer - NUnit, NHibernate

    - by csetzkorn
    Hi, I would like to unit test a DEPENDENT service layer which allows me to perform CRUD operation without mocking using NUnit. I know this is probably bad practice but I want to give it a try anyway - even if the tests have to run over night. My data is persisted using NHibernate and I have implemented a little library that 'bootstraps' the database which I could use in a [Setup] method. I am just wondering if someone has done something similar and what the fastest method for bootstrapping the database is. I am using something like this: var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly("Bla"); new SchemaExport(cfg).Execute(false, true, false); to establish the db schema. After that I populate some lookup tables from some Excel tables. Any feedback would be very much appreciated. Thanks. Christian

    Read the article

  • NHibernate Query object collection issue

    - by Mahesh
    Hi, I am new to NHibernate and need some information regarding the internal working of the engine: I have a table called Student and the design is as follows: RollNo Name City Postcode and there are 5 more columns like this. I have School class and mappings associated with it. I am querying RollNo and Name using session as given below: IQuery query = session.CreateQuery("SELECT RollNo,Name FROM Student); Executing query.List resulting in error because the query is returning object[][]. Now, I changed the query as given below: IQuery query = session.CreateQuery("FROM Student); Executing query.List on this query yeilds the desired results. But, the results contain more data than I want. Could you please let me know the query to which I can get RollNo and Name from Student and castable as Student collection. Thanks, Mahesh

    Read the article

  • Computed properties in NHibernate

    - by Liron Levi
    I'm having a problem in mapping an existing data class member to the database.. I have a database table where one of the columns is a string type, but actually stores a comma separated list of numbers. My data class shows this field as a list of integers. The problem is that I couldn't find any hook in NHibernate that allows me to invoke the custom code that is required to replace the string field by the list and vice versa. To illustrate (simplified of course): The database table: CREATE TABLE dummy ( id serial, numlist text -- (can store values such as '1,2,3') ) The data class: class Dummy { public int Id; public List<int> NumbersList; } Can anyone help?

    Read the article

  • Load vs Get in Nhibernate

    - by Quintin Par
    The master page in my web application does authentication and loads up the user entity using a Get. After this whenever the user object is needed by the usercontrols or any other class I do a Load. Normally nhibernate is supposed to load the object from cache or return the persistent loaded object whenever Load of called. But this is not the behavior shown by my web application. NHprof always shows the sql whenever Load is called. How do I verify the correct behavior of Load? I use the S#arp architecture framework.

    Read the article

  • Nhibernate not tracking changes

    - by Lavinski
    I'm using nhibernate and it appears that changes to my new object are not persisted. After creating and saving an object I then modify it and commit the transaction. However none of the modifications are saved. The strange thing is this code was working previously and I have no idea what could cause this. Nothing was changed that's obviously related.. As an attempted work around I saved the object later in the procedure after all the changes where made however I was greeted with an Assertion Failure collection [] was not processed by flush. Any ideas?

    Read the article

  • NHibernate & Cancelling Changes to Entities

    - by user129609
    Hi, This seems like it would be a common issue to be but I don't know the best way to solve it. I want to be able to send an Entity to a view, have changes be made to the entity in the view, but then cancel (remove) those changes if the user cancels out of the view. What is the proper way to do this. Here are two options I have but I think there should be others that are better 1) Take an entity, create a clone, send the clone to the view...if changes are accepted, update the original entity with the clone's values 2) Send the entity to the view, if the user cancels, remove the entity from NHibernate's cache and reload it from the database For (2), the issue for me would be that the old entity could still be referenced throughout my project after it has been removed from the cache.

    Read the article

  • NHibernate HQL logic problem

    - by Jon
    Hi I'm trying to write an NHibernate HQL query that makes use of parenthesis in the where clause. However, the HQL parser seems to be ignoring my parenthesis, thus changing the meaning of my statement. Can anyone shed any light on the matter? The following HQL query: from WebUser u left join fetch u.WebUserProfile left join fetch u.CommunicationPreferences where (u.CommunicationPreferences.Email = 0 and u.SyncDate is not null) or u.DateDeleted is not null translates to: from WebUser webuser0_ left outer join WebUserProfile webuserpro1_ on webuser0_.UserId = webuserpro1_.WebUserId left outer join WebUserCommunicationPreferences communicat2_ on webuser0_.UserId = communicat2_.UserId where communicat2_.Email = 0 and (webuser0_.SyncDate is not null) or webuser0_.DateDeleted is not null Thanks Jon

    Read the article

  • Get list of named queries in NHibernate

    - by Dan
    I have a dozen or so named queries in my NHibernate project and I want to execute them against a test database in unit tests to make sure the syntax still matches the changing domain/database model. Currently I have a unit test for each named query where I get and execute the query, for example: IQuery query = session.GetNamedQuery("GetPersonSummaries"); var personSummaryArray = query.List(); Assert.That(personSummaryArray, Is.Not.Null); This works fine, but I would like to have one unit test that loops thru all of the named queries and executes them. Is there a way to discover all of the available named queries? Thanks Dan

    Read the article

  • NHibernate connection string configuration

    - by user177883
    I have a c# library project, that i configured using nhibernate, and I like people to be able to import this project and use the project. I have a connection string in hibernate config file and in app.config file of another project. it would be nice for anyone to be able to set the connection string into this library project and use it. How to do this? I d like this class library to use the same database of the project that s imported. How to set hibernate connection string programatically? same idea for log4net.

    Read the article

  • NHibernate: insert multiple items at once

    - by Gart
    Hello, all! I am learning NHibernate now and I would like to know is it possible to save multiple objects to database in one operation. For example, consider this test code private static void SaveTestBillNamesInSession(ISession session, params string[] names) { var bills = from name in names select new Bill { Name = name, DateRegistered = DateTime.Now, }; foreach (var bill in bills) session.SaveOrUpdate(bill); } This loop here generates many INSERT statements which may be sub-optimal in SQL Server 2008 which allows to include multiple data rows in one INSERT statement. Is it possible to rewrite this code to make use of this functionality - insert all the data in one operation?

    Read the article

  • NHibernate Validator - how to validate enum type

    - by Herr W.
    I'm using nhibernate validator in my current solution. Everythings is almost fine but... My view model has a property of type Gender (see example below) public virtual Gender Gender { get; set; } public enum Gender { Female = 1, Male = 2 } Now i like to have some validation to ensure that the gender property ist set. But neither the NotEmpty nor the NotNull Attribute fulfil the requirement. Is there a kind of a generic solution or best practice to handle enum validations. Thanks in advance.

    Read the article

  • Fluent NHibernate SchemaExport to SQLite not pluralizing Table Names

    - by weenet
    I am using SQLite as my db during development, and I want to postpone actually creating a final database until my domains are fully mapped. So I have this in my Global.asax.cs file: private void InitializeNHibernateSession() { Configuration cfg = NHibernateSession.Init( webSessionStorage, new [] { Server.MapPath("~/bin/MyNamespace.Data.dll") }, new AutoPersistenceModelGenerator().Generate(), Server.MapPath("~/NHibernate.config")); if (ConfigurationManager.AppSettings["DbGen"] == "true") { var export = new SchemaExport(cfg); export.Execute(true, true, false, NHibernateSession.Current.Connection, File.CreateText(@"DDL.sql")); } } The AutoPersistenceModelGenerator hooks up the various conventions, including a TableNameConvention like so: public void Apply(FluentNHibernate.Conventions.Instances.IClassInstance instance) { instance.Table(Inflector.Net.Inflector.Pluralize(instance.EntityType.Name)); } This is working nicely execpt that the sqlite db generated does not have pluralized table names. Any idea what I'm missing? Thanks.

    Read the article

  • How do I return a bit from a stored procedure with nHibernate

    - by tigermain
    I am using nHibernate in my project but I have a stored procedure which just returns a boolen of success or now. How do I code this in c#? I have tried the following but it doesnt like cause I dont have a mapping for bool!!! {"No persister for: System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"} IQuery query = NHibernateSession.CreateSQLQuery("EXEC MyDatabase.dbo.[ContentProvider_Import] :ContentProviderImportLogId", "success", typeof(bool)) .SetInt32("ContentProviderImportLogId", log.Id); var test = query.UniqueResult<bool>(); and the same result from IQuery query = NHibernateSession.CreateSQLQuery("EXEC MyDatabase.dbo.[ContentProvider_Import] :ContentProviderImportLogId") .AddEntity(typeof(bool)) .SetInt32("ContentProviderImportLogId", log.Id); var test = query.UniqueResult<bool>();

    Read the article

  • NHibernate - is property lazy loading possible?

    - by Ben
    I've got some binary data that I store and was going to separate this out into a separate table so it could be lazy loaded. However, i then came across this post by Ayende (http://ayende.com/Blog/archive/2010/01/27/nhibernate-new-feature-lazy-properties.aspx) which suggests that property lazy loading is now possible. I have added the lazy="true" attribute to my property mapping but the field is still loaded from the database (I am using a simple text field to test). My query: return _session.CreateQuery("from Product") .SetMaxResults(1) .UniqueResult<Product>(); Mapping: <property name="Description" type="string" column="FullDescription" lazy="true"/> Has anyone been able to get this working? Personally I prefer this approach than having to add another table to my database.

    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

  • Implementing auto-save in WPF / MVVM / NHibernate

    - by Echiban
    My client likes programs like Microsoft OneNote where changes are saved automatically, and he can choose to discard when he explicitly wants to do so. I will have to implement some undo functionality, but I'll figure that out some other time. With NHibernate, I suppose I can call ISession.Update on every single property / binding change, but I can see real pain with this approach down the road. I am not a fan of timers, but maybe a 5 second timer that starts on property / binding change and at timer end use BackgroundWorker thread to save to db. What do you think?

    Read the article

  • Linq to NHibernate using Queryable.Where predicate

    - by Groo
    I am querying an SQLite database using LINQ to NHibernate. Person is an entity containing an Id and a Name: public class Person { public Guid Id { get; private set; } public string Name { get; private set; } } Let's say my db table contains a single person whose name is "John". This test works as expected: var query = from item in session.Linq<Person>() where (item.Name == "Mike") select item; // no such entity should exist Assert.IsFalse(query.Any()); but this one fails: var query = from item in session.Linq<Person>() select item; query.Where(item => item.Name == "Mike"); // following line actually returns the // "John" entry Assert.IsFalse(query.Any()); What am I missing?

    Read the article

  • Recommendations for supporting both Oracle and SQL Server in the same ASP.NET app with NHibernate

    - by Hugo Zapata
    Our client wants to support both SQL Server and Oracle in the next project. Our experience comes from .NET/SQL Server platform. We will hire an Oracle developer, but our concern is with the DataAccess code. Will NHibernate make the DB Engine transparent for us? I don't think so, but i would like to hear from developers who have faced similar situations. I know this question is a little vague, because i don't have Oracle experience, so i don't know what issues we will find.

    Read the article

  • Using Sculpture with NHibernate or Entity Framework

    - by Sergei
    I recently ran across this open-source project: http://www.codeplex.com/Sculpture Sculpture is a code-generator which allows you to design your domain model and then use persistence 'molds' such as NHibernate/EF and probably more to generate repositories. It takes care of all the mapping and Data access generation. It looks like it does a heck of a lot more, but i'm pretty much sold at this point. However, i would like to know if anyone here used this for real-world solutions. If so, how well does it scale? How did the generated DAL work for you?

    Read the article

  • Help creating a ColumnName Convention using FluentNHibernate

    - by Rafael E. Belliard
    I've been trying to specify a custom naming convention for my database table columns. So far, I have been able to setup a convention for the table's name, but not the actual columns. I've seen a few guides on the internet, but they're not working using the latest Fluent NHibernate (1.0.0 RTM). public class CamelCaseSplitNamingConvention : IClassConvention, IComponentConvention { public void Apply(IClassInstance instance) { instance.Table(instance.EntityType.Name.ChangeCamelCaseToUnderscore()); } public void Apply(IComponentInstance instance) { // is this the correct call for columns? If not, which one? } } Please help.

    Read the article

  • How to create mapping for a List<SomeNativeType> in FluentNhibernate ?

    - by Mahesh Velaga
    Hi all, I am trying to create a mapping file for the following Model using Fluent NHibernate. But, I am not sure of how to do the mapping for the List in the mapping file. public class MyClass { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual List<string> MagicStrings { get; set; } } public class EnvironmentMapping : ClassMap<Models.Environment> { public EnvironmentMapping() { Id(x => x.Id); Map(x => x.Name); //HasMany(x => string) What should this be ? } } Help in this regard is much appreciated. Thanks!

    Read the article

  • NHibernate How to specify custom sql type only in production

    - by Davide Orazio Montersino
    I am saving binary files into a Sql Server 2005 Db using Fluent NHibernate. However, I am using SQLite to run my (pseudo) Unit Tests. I need to use a custom Sql type for Ms Sql, but it would throw an error on SqlLite. What strategies can I use? This is the Map file: public class BinaryFile { public BinaryFile() { m.Map(x => x.BinaryData);//.CustomSqlType("varbinary(MAX)"); m.Map(x => x.ContentType); m.Map(x => x.FileName); m.Map(x => x.FileSize); } }

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >