1. It is problematic to compare DateTime values when using DateTime.Now to set the value because Ms Sql Server can NOT store dates with the same accuracy as the DateTime struct can - so it is possible to store a DateTime and not retrieve the exact same DateTime.
2. We can't compare the blogItem.ParentBlog and item.ParentBlog because they will be differnt objects since they were loaded in "different sessions". If Blog implemented Equals() and GetHashCode() correctly then we could compare them - they would be equal by object equality - blog.Equals(otherBlog), but not have by object identity - blog==Otherblog - because they would be seperate objects in memory. NHibernate guarantees the same object by identity inside of a Session only.
3. The only way to make sure these are referring to the same blog is by checking for database identity equality - ie: comparing there property "Id" because that is the property used as the primary keys.
星期三, 12月 15, 2004
Struggling with new NHibernate Alpha-0.5.0.0 #2
昨天NHibernate 裡nunit.framework.dll的問題我找到了一個比較好的辦法
就是在參考裡面選則該參考(nunit.framework.dll)後按右鍵選擇屬性
把複製本機的欄位給改成false就可以了
但是這樣就會有一個問題
就是在coding時由這個reference所帶進來的類別裡的成員都看不到
所應該有的intellisense也都沒有了
連要在程式碼中相關method上想移至定義都不行
但是compiler卻可以過
只有一些Textfixture與Assertu已在其它地方定義過的警告
而compile過了以後在NUnit GUI裡仍可正常運作
不過這樣已經夠我繼續研究我的NHibernate了
畢竟只要一些基本的NUnit功能可以使用就夠了
就是在參考裡面選則該參考(nunit.framework.dll)後按右鍵選擇屬性
把複製本機的欄位給改成false就可以了
但是這樣就會有一個問題
就是在coding時由這個reference所帶進來的類別裡的成員都看不到
所應該有的intellisense也都沒有了
連要在程式碼中相關method上想移至定義都不行
但是compiler卻可以過
只有一些Textfixture與Assertu已在其它地方定義過的警告
而compile過了以後在NUnit GUI裡仍可正常運作
不過這樣已經夠我繼續研究我的NHibernate了
畢竟只要一些基本的NUnit功能可以使用就夠了
訂閱:
文章 (Atom)