Re: ActiveRecord mapping

2010-04-19 Thread Diego Dias
I do not apply lazy load because in any cases the inner work and in others not work. Do you never looked the querys that the NH generates? 2010/4/16 Markus Zywitza markus.zywi...@gmail.com Did you try with a lazy loaded collection already? -Markus 2010/4/15 Diego Dias diego.d...@gmail.com

Re: ActiveRecord mapping

2010-04-16 Thread Markus Zywitza
Did you try with a lazy loaded collection already? -Markus 2010/4/15 Diego Dias diego.d...@gmail.com I did a test: ICriteria c = session .CreateCriteriaMatricula(); c.SetFirstResult(0) .SetMaxResults(10);

Re: ActiveRecord mapping

2010-04-15 Thread Diego Dias
I did a test: ICriteria c = session .CreateCriteriaMatricula(); c.SetFirstResult(0) .SetMaxResults(10); ICriteria c2 = CriteriaTransformer.Clone(c); var count =

ActiveRecord mapping

2010-04-13 Thread Diego Dias
Good morning, guys. I'm with a problem with the query that NHibernate generates. My mapping is like bellow: public class Matricula { [BelongsTo(IdTurma, NotNull=True)] public Turma {get;set;} } public class Turma { [BelongsTo(IdCurso,

Re: ActiveRecord mapping

2010-04-13 Thread Markus Zywitza
What is the query (in HQL or LINQ)? -Markus 2010/4/13 Diego Dias diego.d...@gmail.com Good morning, guys. I'm with a problem with the query that NHibernate generates. My mapping is like bellow: public class Matricula { [BelongsTo(IdTurma, NotNull=True)]

Re: ActiveRecord mapping

2010-04-13 Thread Diego Dias
I use ICriteria and is query I get in sql profile. 2010/4/13 Markus Zywitza markus.zywi...@gmail.com What is the query (in HQL or LINQ)? -Markus 2010/4/13 Diego Dias diego.d...@gmail.com Good morning, guys. I'm with a problem with the query that NHibernate generates. My mapping is like

Re: ActiveRecord mapping

2010-04-13 Thread Markus Zywitza
Can you share the ICriteria query code then? -Markus 2010/4/13 Diego Dias diego.d...@gmail.com I use ICriteria and is query I get in sql profile. 2010/4/13 Markus Zywitza markus.zywi...@gmail.com What is the query (in HQL or LINQ)? -Markus 2010/4/13 Diego Dias diego.d...@gmail.com

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-14 Thread Markus Zywitza
Please open an issue at Donjon, preferably with a patch. -Markus 2009/10/13 Mike Christensen m...@kitchenpc.com One quick question. Why do I need to do: [Property(NotNull = true, ColumnType = Website.Price, Website)] public Price VendorFees {get; set;} Shouldn't it know the ColumnType

ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread Mike Christensen
Hi guys - I've been struggling with this one for a while, the scenario seems very basic but I've spent several hours on this and run into what seems like NHibernate bugs.. Here's the situation. I have a class called Price which is implemented like this: [Serializable] public class Price :

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread Mauricio Scheffer
First, consider using System.Decimal instead of your own Price class. If you still need some special feature and absolutely need your own Price class, write a NHibernate IUserType. Here are some sample user types: http://nhforge.org/wikis/howtonh/tags/IUserType/default.aspx On Oct 12, 5:14 pm,

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread Mike Christensen
Thanks! Normally I'd just use Int32 or Decimal to store prices, but my Price class has various functionality, formatting abilities, is recognized by my Javascript layer, and all sorts of other things.. I will look into the IUserType thing, thanks! Mike On Mon, Oct 12, 2009 at 1:23 PM,

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread Mike Christensen
Hi - The URL you mentioned only seems to contain information about persisting enums as strings, which is great since I was wondering about that as well (as PostgreSQL users string for enums).. Can you point me to any relevant information about IUserType and how to create a user defined type that

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread Mike Christensen
Hi - The IUserType approach almost works, however I need to mark my type as [Serializable] which the implementation for IUserType does not allow for.. You'll get a circular reference detected when serializing the getters.. Guess it's back to the drawing board.. Mike On Mon, Oct 12, 2009 at

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread G. Richard Bellamy
That doesn't sound right... I've serialized IUserType before. Let me try to find a sample... On Mon, Oct 12, 2009 at 5:15 PM, Mike Christensen m...@kitchenpc.comwrote: Hi - The IUserType approach almost works, however I need to mark my type as [Serializable] which the implementation for

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread Mike Christensen
Got it.. (BTW, I was referring to the JavascriptSerializer - perhaps the XmlSerializer is smarter).. You just have to mark the extra stuff with ScriptIgnore, such as this: [ScriptIgnore] public Type ReturnedType { get { return typeof(Price); } } Everything is working awesome now!!! Thanks

Re: ActiveRecord - Mapping custom class to numeric data type on server

2009-10-12 Thread Mike Christensen
One quick question. Why do I need to do: [Property(NotNull = true, ColumnType = Website.Price, Website)] public Price VendorFees {get; set;} Shouldn't it know the ColumnType is Price, just as it would know the column type for Int32 or Boolean? Having to specify the ColumnType in the property

Re: ActiveRecord mapping against an Interface

2009-08-11 Thread JakeS
I think the [HasManyToAny] was exactly what I was looking for. Thank you for the replies. On Aug 11, 12:24 am, Markus Zywitza markus.zywi...@gmail.com wrote: Hi Jake, 2009/8/10 JakeS jakesteven...@gmail.com [ActiveRecord] public class WhiteBoard : ModelBaseWhiteBoard, IRecentUpdated

ActiveRecord mapping against an Interface

2009-08-10 Thread JakeS
I've got several classes defined like so: public interface IRecentSpaceItem { [PrimaryKey] int Id { get; set; } DateTime LastUpdated{ get; } } [ActiveRecord] public class WhiteBoard : ModelBaseWhiteBoard, IRecentUpdated [ActiveRecord] public class Discussion:

Re: ActiveRecord mapping against an Interface

2009-08-10 Thread jsmorris
I think that you need to use the [HasManyToAny] attribute to map your collection of IRecentUpdated objects to a list of possible types. Take a look at http://www.castleproject.org/activerecord/documentation/trunk/usersguide/relations/hasmanytoany.html This is just off the cuff, but I believe

Re: ActiveRecord mapping against an Interface

2009-08-10 Thread Markus Zywitza
Hi Jake, 2009/8/10 JakeS jakesteven...@gmail.com [ActiveRecord] public class WhiteBoard : ModelBaseWhiteBoard, IRecentUpdated [ActiveRecord] public class Discussion: ModelBaseDiscussion, IRecentUpdated You can get around it completely, if you use generic interfaces: public interface

Re: ActiveRecord mapping error

2009-07-16 Thread Jimmy Shimizu
Thanks for your reply. The initialization of the IList was not the issue, I actually initialized it upon population therefor it didn't issue an exception for it (I have however rewritten it now). The fact remains though, and I seem to have nailed down what causes it. If I add Index to the

Re: ActiveRecord mapping error

2009-07-16 Thread Markus Zywitza
Please open an issue at donjon, I'll add a guard clause in the AR-initialization. -Markus 2009/7/16 Jimmy Shimizu jimmy.shim...@gmail.com Thanks for your reply. The initialization of the IList was not the issue, I actually initialized it upon population therefor it didn't issue an exception

Re: ActiveRecord mapping error

2009-07-16 Thread Jimmy Shimizu
http://support.castleproject.org/projects/AR/issues/view/AR-ISSUE-266 Markus Zywitza wrote: Please open an issue at donjon, I'll add a guard clause in the AR-initialization. -Markus 2009/7/16 Jimmy Shimizu jimmy.shim...@gmail.com mailto:jimmy.shim...@gmail.com Thanks for your

ActiveRecord mapping error

2009-07-15 Thread Jimmy Shimizu
Hi, I came across an issue when mapping an HasMany-collection. with the following code: private IListCartDiscount applicableDiscounts; [HasMany( typeof( CartDiscount ), Access = PropertyAccess.FieldCamelcase, Cascade =

Re: ActiveRecord mapping error

2009-07-15 Thread Markus Zywitza
If you put the HasMany on the IEnumerable, NH tries to add things to the IEnumerable. I think the error is an NH bug, because the value is not tested against null before checking the character. Nonetheless, your approach won't function. Use instead a protected or private IList for mapping and