.netTiers Implementation

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/23/2010 9:21:28 PM
Gravatar
Total Posts 13

.netTiers Implementation

Used .netTiers to create a custom app and now we want to implement that with mojoPortal. We converted the CodeSmith generated pages to UserControls and registered those as modules. We then created mojoPortal pages and added the modules to the page. The pages that perform searches and retrieve information for editing work.

The problem is that the Insert and Update functions cause a Sql Timeout error.  The application hangs and an error message like the following is in the mojoPortal system log. We tried using both stored procedures and embedded Sql statements for the .netTiers.

2010-11-23 20:41:52,340 ERROR mojoPortal.Web.Global - 68.190.10.213-en-US - /OrganizationEdit.aspx?OrganizationId=1
System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command, DbTransaction transaction)
at Catering.DAL.Utility.ExecuteReader(TransactionManager transactionManager, DbCommand dbCommand)
at Catering.DAL.SqlClient.SqlOrganizationProviderBase.GetByOrganizationId(TransactionManager transactionManager, Int32 _organizationId, Int32 start, Int32 pageLength, Int32& count)
at Catering.DAL.Bases.OrganizationProviderBaseCore.GetByOrganizationId(TransactionManager transactionManager, Int32 _organizationId)
at Catering.Web.Data.OrganizationDataSourceView.GetSelectData(Int32& count)
at Catering.Web.Data.BaseDataSourceView`2.GetCachedData(Int32& count)
at Catering.Web.Data.BaseDataSourceView`2.GetEntityList(DataSourceSelectArguments arguments, IDictionary values)
at Catering.Web.Data.BaseDataSourceView`2.ExecuteSelectCore(DataSourceSelectArguments arguments)
at Catering.Web.Data.BaseDataSourceView`2.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.FormView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.FormView.EnsureDataBound()
at System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

Any thoughts to get us going in the right direction?

11/24/2010 8:30:51 AM
Gravatar
Total Posts 18439

Re: .netTiers Implementation

How are you passing in your connection string?

mojoPortal uses a connection string from the<appSettings section but my guess is with the tools you are using you need to setup a connection string in <connectionStrings section

Hope it helps,

Joe

11/24/2010 8:38:42 AM
Gravatar
Total Posts 13

Re: .netTiers Implementation

You are correct. The tools we used want to pull the connection string from the <connectionStrings> section. We added the <connectionStrings> section to the web.config file. It "seems" like it is working because we can pull back information from the application database.  I say "seems" because something is obviously not exactly right because the Insert and Update functions aren't working.

11/24/2010 8:45:52 AM
Gravatar
Total Posts 18439

Re: .netTiers Implementation

Ok, so you are getting a connection, sorry but I cannot diagnose the problems with your code that I have no idea about. If you have long running operations you may need to add appropriate indexes, review the efficiency of the sql statements, set a longer timeout on your connection and command etc

I don't know anything about .netTiers and cannot offer any support for it. Maybe others in the community have used it and could help further.

Best,

Joe

11/24/2010 8:52:58 AM
Gravatar
Total Posts 13

Re: .netTiers Implementation

Thanks for the replies.

I was hoping maybe someone had encountered this before. It is not a heavy transaction, just adding/updating 1 record with a minimal number of fields. It seems straightforward enough...

 

 

 

11/24/2010 9:03:38 AM
Gravatar
Total Posts 18439

Re: .netTiers Implementation

make sure the table has a primary key and make sure you are using the same connection string for insert and update as you are for select. a simple typo could cause it.

11/24/2010 9:26:14 AM
Gravatar
Total Posts 13

Re: .netTiers Implementation

Yes. The table has a primary key and the code is using the same connection string. The app is an existing app that works outside of mojoPortal. We were just converting the application pages to UserControls. We wanted to see if we could combine the features of mojoPortal with the features of some auto-generated code. I think it can be done... just need to get through some of these oddities.

11/24/2010 9:31:54 AM
Gravatar
Total Posts 18439

Re: .netTiers Implementation

I don't know if .netTiers generated code uses any ASP.NET PageMethods, but if they do, that won't work in a UserControl.

11/25/2010 7:50:08 AM
Gravatar
Total Posts 13

Re: .netTiers Implementation

Solved the probkem... Put the code away for awhile, worked on something else, got a good night sleep, re-investigated the web.config file Forgot to to include the EntityTransactionModule configuration in the httpModules section Thanks Joe - onto the next challenge (or stupid mistake)
11/30/2010 5:02:45 PM
Gravatar
Total Posts 1

Re: .netTiers Implementation

Hello,

I think this is a bug in the .netTiers generated code. This has been fixed in revision 858 of the templates. This can be downloaded here.

Would someone mind writing a blog post on integrating .netTiers with their mojoPortal? I'd love to mirror this content smiley

Thanks

-Blake Niemyjski (CodeSmith Software Development Engineer and .NetTiers Team member). 

11/30/2010 5:15:53 PM
Gravatar
Total Posts 13

Re: .netTiers Implementation

There might be a bug in the .netTiers framework... but my problem was that I missed copying a configuration setting from the .netTiers generated web.config file to the mojoPortal web.config file. Specifically, it was the EntityTransactionModule configuration in the httpModules section. I have a series of notes on what I did for the integration.. maybe I will turn that into a blog post..

Anyone else interested in something like that?

You must sign in to post in the forums. This thread is closed to new posts.