Quote: Our Deepest Fear

May 30th, 2008 1 Comment »

"Our deepest fear is not that we are inadequate. Our deepest fear is that we are powerful beyond measure. It is our light, not our darkness that most frightens us. We ask ourselves, Who am I to be brilliant, gorgeous, talented, fabulous? Actually, who are you not to be? You are a child of God. Your playing small does not serve the world. There is nothing enlightened about shrinking so that other people won't feel insecure around you. We are all meant to shine, as children do. We were born to make manifest the glory of God that is within us. It's not just in some of us; it's in everyone. And as we let our own light shine, we unconsciously give other people permission to do the same. As we are liberated from our own fear, our presence automatically liberates others."

 

- Marianne Williamson, A Return to Love (1992)

Technology: NHibernate初学感受

May 30th, 2008 No Comments »

NHibernate终于正常工作了:)

前两天配这个东西的时候一直在用非原始设计思路去处理一个问题……结果么,就是得到的结果一直不正常。。。-_- (这个事实教育我们要仔细阅读文档,尤其是样例....-_-但问题是我好像有从头到尾扫了一遍doc...仍然忽视掉了NH的操作方法。。)

对NHibernate的初步感受么,很容易用着用着出现非常奇异的小bug (看到有其他用户提出之中的一些...另外一些可能只是自己使用不当吧) 然后,对完全的ORM的应用还是稍微有点不适应的;总感觉这么用是以性能代价换取移植与封装性。包括这次课程要求。。。居然很多东西都要读到内存中再操作;但其实明明是一条SQL(最多SP)就能搞定的东西……

Anyway, 做的过程中记了些可能有用的Tips,不过不知道为什么只找到这几个.... 其他的之后再补充上吧。

> NHibernate.ObjectDeletedException : deleted object would be re-saved by cascade:

Solution 1) 首先移除子对象和父对象间的Association再删除

Solution 2) 在子对象Many-to-one边添加cascade

> 可以通过检查HttpContext.Current是否为空来做一个可同时用于WinForms和WebForms的PersistenceLayer (似乎废话……不过刚开始没想到就是了)