Fluent Nhibernate configuring OptimistickLock.Dirty() with Transaction.IsolationLevel.ReadCommited when the row locked in Oracle 10g
The problem is :
I have a working system with FluentNhibernate.
I have a legacy database and it's hybrid system which suppose to give an answer to a new and old systems as one. So that means I couldn't use the Version - which means at this point to change the schema and add column to each table.
I've added OptimistickLock.Dirty() with Transaction.IsolationLevel.ReadCommited() to deal with the problem of locking .
The trouble is that when the row locked in Oracle 10g and I am trying to SaveOrUpdate the entity it just stops the application.
Then , when I save or rollback in Oracle the Application gets the process back and throws the exception NHibernate.StaleObjectStateException that is being handled in my exception handler which is fine.
The question is how to make the application to recognize on the spot that there is a lock on the current row I am trying to access and throw the adequate exception .
Debugging another project DLL
My problem was to enter the referenced DLL to my project while I was debugging to analyze the mistake that has been created in it.
The solution is : With the DLL you need to make sure
1. it was built in DEBUG mode
2. it has the pdb file with it
Without these 2 you cannot debug the code
When I placed the pdb file in my projects bin folder it worked like a magic .
Basic Asp.Net Life Cycle
A bit about the order in the asp.net forms
Public Class _Default
Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
'if ths post is a postback we can check the IsPostback property
'if this is a Postback the user controls hasn't been reconstituted from the viewstate yet
'set things that are global to the page
'dynamicly set a master page or a theme property , desision based on a geography or a time
'dynamicly added controls by a logic
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'rewrite any specific control properties
Private Sub Page_InitComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.InitComplete
'after all of the initialazation took place
'logic that depends on the controls initialized
Private Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad
'pre loads for all of the controls are being fired
'after this viewstate is being initialized
'all of the post back data is being initialized from the postback
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'any child control event implemented is being fired
Private Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
'any task that requires all of the controls on the page to be loaded and validated
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
'final changes to controls before its becoming the html
Private Sub Page_SaveStateComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SaveStateComplete
'viewstate has been saved
'won't be rendered to the page
'can apply some logic that requires the viewstate to be completed
Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
'close any files
'release any db connecions
When Not to Use Thread Pool Threads
There are several scenarios in which it is appropriate to create and manage your own threads instead of using thread pool threads:
You require a foreground thread.
You require a thread to have a particular priority.
You have tasks that cause the thread to block for long periods of time. The thread pool has a maximum number of threads, so a large number of blocked thread pool threads might prevent tasks from starting.
You need to place threads into a single-threaded apartment. All ThreadPool threads are in the multithreaded apartment.
You need to have a stable identity associated with the thread, or to dedicate a thread to a task.
Sql - special chars select - records with like condition including %
select * from tableName t
where t.ColumnName LIKE '%\%%' escape '\'
System Error &H80004005& - missing file in project
Error in debug compilation for WebApp project "Unable to write to output file '[project path]\obj\Debug\[website].pbd' : System Error &H80004005&"
Turns out there was a file in the project that didn't exist (little exclamation mark on the file in solution explorer).
Our solutions , the programmer that checked the .proj file in should :
1).Exclude from project the file he's working on , and didn't want to check in and then check in the project file.
2).Finish development until the compilation is fine , than check in the project file.
3).If the file is redundant and was left by some reason , just delete the file and rebuild the project .