MVC :: Implemented NHibernate / Application Completely Unstable?
Jun 1, 2010
I tried to figure out NHibernate (a first) First went through chapter 23 in Asp.Net MVC in Action 2, and read some articles to get the drift.
Then I modified the sample in the above book to work with my own database and my own table. Finally got that working. (Started messing with this yesterday afternoon....it's 7:30 AM, so .... I'm tired...)
Then I worked this into my own project (the shared mvc template some of you might have looked at).
Now my application became completely unstable. Sometimes it work, but other times it bombs out where my controller factory (Castle) set the component lifestyles:
[Code]....
Each time with some LoaderException that read like {"Could not load file or assembly 'Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc"}
Man I fiddled all over the place, having xcopy copy dll's (see krok.web properties got a post build event) and many other things I that does not really make sense.
And from the darned instructions, having all your dll's in a folder which get copied out to the web project's bin folder and dont know what else.
Seriously...if someone can download this and have a look (better not if you dont know Castle Windsor and NHibernate)
View 3 Replies
Similar Messages:
Jun 24, 2010
How to completely disable ControlState in an ASP.NET website application to get rid of <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/ACBDEFGH...XYZ=" /> on every page?
Searching for a solution, I only found meaningless answers making no difference between ControlState and ViewState, or replies saying that "we cannot disable control state". The second assumption seems to be false, since StackOverflow pages do not have ViewState hidden field.
View 2 Replies
Dec 10, 2010
I'm designing my first asp.net web app, using nHibernate as the data provider. i've read a lot about nhibernate in web applications using session-per-request pattern. my application will have a few pages which are 'monitors', meaning- they're updated automatically every few seconds to reflect recent changes to data. in that case, my thought is that opening a session for every request would not make much sense, since I know that an identical request is sure to follow in a few seconds. my thought is that session-per-conversation would make more sense for me, but I'm having trouble finding examples of implementations. I'd appreciate any good resources for how to implement session-per-conversation
View 2 Replies
Mar 11, 2010
I am about to start a new application and am excited about using asp.net mvc and nhibernate. However, the big "problem" is how I handle the user authentication stuff. What are some ways those used to using nhibernate and MVC solve this problem?
My thought is let asp.net do its own thing and I do my own thing database wise. Am curios if I should role my own using the provider model and nhibernate, if I can figure out how. Or is there a way to integrate current code that is in the mvc example into nhibernate?
View 3 Replies
Jul 16, 2010
I see there are 2 possible scenarios as to the session handling:
Open one single ISession per request. Open it at request start and close it at request end.Open one ISession per conceptual "unit of work". Many sessions are created for a request.
The approach #1 is the one I'm doing now. I'm a little bit worried about it because, although it works, it's a little bit difficult to debug. For instance, I have an object not being saved (even though I ordered it to) and I'm having trouble debugging since there's a LOT of things happening during a complete request life-cycle.
The approach #2 seems to be the standard best-practice (not sure about ASP.NET) and I'm sure it's pretty easier to debug. The problem I see is about inter-session communication. For instance: My Page class holds a reference to the User, which is a persistent object. Many of the operations receive the user as parameter. As the user belongs to a different session, I can't pass it as a parameter.
I'm biased to #2, but I don't know if it's the best practice, nor how to deal with cross-session object.
View 4 Replies
Oct 15, 2010
I have scoured the web and have yet to find and example that matches my requirements.
What I have is an existing multi-tenant asp.net application where all users authenticate against a single SQL Server database. This database also contains several other settings type data that is used within the application. Each client after authentication, utilizes thier own SQL Server database for data storage, for isolation purposes. Essentially all of the client database are identical and reside on the same server, but reside on one or more servers as well.
The application is currently written in asp.net 2.5 framework and utilizes the Micrsoft Practices Enterprise Library for DAL. Wnd we are looking to migrate to 4.0 and implement NHibernate to replace the MPEL.
I have implemented a solution already using NHibernate and the 4.0 framework, so I am familar with the concepts. I found the resources for my current session manager here as a matter of fact. But that application only had a single database, so not much too it.
The implementation is essentially what you see here:
[URL]
The other solutions that I have seen multiple config entries and/or files to manage this, but that is not desireable, since we may add new clients frequently and all of the connection information is already maintained in the authentication database.
[code]....
View 1 Replies
Jul 11, 2010
I was wondering if there's anybody that can give me an idea how the component Calendar (even button) is implemented. Do you know a place where I could see it?
View 1 Replies
Sep 9, 2010
I have own control implemented in "CommonControls" assembly (the same namespace). It us 'Custom control' inherited from 'WebControl' class and implemented without ascx file.
It is necessary to use this control in "main" web site. how to register this control?
I know it should be something like this:
<%@ Register Assembly="CommonControls" Namespace="CommonControls"
TagPrefix="uc" TagName="TopMenuControl" Src="..." %>
But what should I specify in the "Src" property?
View 1 Replies
Jan 8, 2010
Whenever I try to use the Website Administration Tool i get an error messege stating:
error invoking ad&minister website.
Details: The method or operation is not implemented.
How can I fix this?
View 4 Replies
Mar 11, 2011
I have just been dabbling in MVC over the last couple of weeks. Knew I wanted to go in this direction but have been putting it off due to comfort/familiarity with webforms. Also knew that with my first MVC site I wanted it to support mobile devices. One of the first tutorials I saw implemented an Area for mobile support. I started that way as well.
Since I want to get off on the proper footing here I guess I'd like to ask you guys. What would the best practice be? Is it just a matter of preference? Are there any specific pros or cons to using or not using Areas when it comes to support for mobile devices?
View 1 Replies
Mar 22, 2011
suggest me a good design pattern for implmenting the following? I have an object say myObject. This myObject is created using few inputs from the UI. After the creation of myObject. This object will be passed to few methods.. like method1(myObject);
method2(myObject);... method5(myObject);etc. Each methods will prepare the input for successive methods call. For example method1(myObject) will set the values necessary for the operation of method2.Then method2(myObject) will set up the values necessary for the operation of method3 and so on..Same object is used as the argument for every method calls.Which design pattern can be implemented?
View 2 Replies
Jan 18, 2011
I want to implement a restful service in ASP.NET. I want it to be compatible with .Net 2.0 and IIS 5+. I am constrained to not use ASP.NET MVC or REST starter kit. By reading on internet I have learned that it can be implemented using HTTPHandlers. The problem is, the request will come in as a POST request. And I want to URL to be like:
http://abc.com/MyService/MyMethod1/
and
http://abc.com/MyService/MyMethod2/
View 3 Replies
May 17, 2010
I am having troubles understanding the purposes of using Factory pattern, I understand Factory pattern uses Factory class that has methods to return concrete objects. But why don't I simply use new opertor to create concrete objects? Some articles suggest Factory methods could return objects of different concreate classes, I can do the same thing by using switch statement.
Also are there classes in .Net framework already implementing Factory pattern? I think that will give me a better ideas why it is useful.
View 5 Replies
Sep 10, 2010
Here I have a code using ControlBuilder to make DropDown control generic.
[ControlBuilder(typeof(EnumDropDownControlBuilder))]
public class EnumDropDown : DropDownList {
private string _enumType;
private bool _allowEmpty;
public string EnumType {
get { return _EnumType; }
set { _EnumType = value; }
}
public bool AllowEmpty {
get { return _allowEmpty; }
set { _allowEmpty= value; }
}
}
public class EnumDropDown<T> : EnumDropDown where T : struct {
public EnumDropDown() {
this.Items.Clear();
if (AllowEmpty) this.Items.Add(new ListItem("", "__EMPTY__"));
foreach (string name in Enum.GetNames(typeof(T))) {
Items.Add(name);
}
}
public new T SelectedValue {
get {
if (IsEmpty) throw new NullReferenceException();
return (T)Enum.Parse(typeof(T), base.SelectedValue, true);
}
set { base.SelectedValue = Enum.GetName(typeof(T), value); }
}
public bool IsEmpty {
get {
return base.SelectedValue == "__EMPTY__";
}
set { base.SelectedValue = Enum.GetName(typeof(T), value); }
}
}
public class EnumDropDownControlBuilder : ControlBuilder {
public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs) {
string enumTypeName = (string)attribs["EnumType"];
Type enumType = Type.GetType(enumTypeName);
if (enumType == null) {
throw new Exception(string.Format("{0} cannot be found or is not an enumeration", enumTypeName));
}
Type dropDownType = typeof(EnumDropDown<>).MakeGenericType(enumType);
base.Init(parser, parentBuilder, dropDownType, tagName, id, attribs);
}
}
Sorry the program is too long to read cheerfully. The question is, although I defined property EnumType, AllowEmpty in class EnumDropDown. Since the real object created by ControlBuilder is EnumDropDown, values of EnumType, AllowEmpty are always null and false in control object. All attributes set in .aspx will be lost! I can read attribute values of source tag in ControlBuilder. But I have no any idea how can I copy the attributes to the generic control object.
View 1 Replies
Apr 28, 2010
I have been asked to join a very small team where one main developer has been buiding the web app (.NET 4.0) during ~6 months. The project should be delivered within next 2 months.
After first look at the code I can say that I would never allow it to go to production (things like catch { }, no tests at all with WebForms etc).
So the code quality is incredibly low.
My task is to improve that and still deliver the solution. So I plan to start with unit testing and MVC2 reimplementing most of the functionality (though using some of the existing code).
I estimate that I will need about 6 weeks to catch up with the current progress and be on te same functionality level as the application will be in 6 weeks.
The problem is that the main developer who has been working on the project seems to be really starting in IT and many basic things are unknown to him. It will take significant amount of time and effort to educate him how to do the proper testing, development and apply some patterns.
I am ready to take responsibility for the reimplemnting the application but at the same time I don't want the main developer to be on idle but as he won't be able to significantly contribute to the better-world project at this stage I am not sure what would the best way to keep productivity high for both of us.
Currently I think following solution is good enough: He proceeds doing what he does until I will catch up with him and then start working on a new project together.
The problem is that of course this approach is not very productive as one developer will do better-world project while the other will proceed with what he did, effectively doing similar tasks.
Another approach would be to pair and try to do things together, but again not sure how productive we will be.
Can you suggest how we could better organise the work together in order to be most efficient for the overall project?
View 3 Replies
Feb 8, 2010
rapidshare,hotfile and many site they restric user to download more than one file at a time. what is their concept and how can i implement this concept by asp.net
View 1 Replies
Dec 13, 2010
I am working on a asp.net reporting project using crystal reports. I am a little new to working on making the project dynamic or reducing down code.
I have many aspx pages which are using the same logic of collecting input from textboxes and inputing to business logic layer.
I was thinking if someone can suggest me inheritance and interface/abstract method to be implemented on muliple aspx pages?
View 9 Replies
Jan 23, 2011
used the built-in Membership framework and has implemented his own provider by creating a class that inherits from MembershipProvider (found in System.Web.Security). I actually went ahead and created a custom provider which inherits from MembershipProvider. The problem is that there are several methods I do not really need. Also, the schema is totally different. Plus, most methods return a MembershipUser which means my User class has to inherit from it as well. So really, what benefits does the MembershipProvider and the whole Membership framework add to my system? Do these benefits justify the fact that I won't be using most of the methods on the class?
View 7 Replies
Jul 18, 2010
i have a big query and many data
when i try to execute this query i got this error
how can i run this query complete?
View 3 Replies
Feb 17, 2011
I am trying to make a UserControl that have all data process, initialize data, ajax, all self contain into one control.So I can insert to anywhere on my Asp pages.But the problem is, the UserControl contains a Script Manager and the Page that contain that User Control has a Script Manager too, so Asp doesn't allow me to have two Script Manager in one page.In case like this, I wonder if UserControl can completely self contain?Or the proper way of using UserControl is just using it like a template, and all the data process, event handler I have to do on the page that contains the UserControl?
View 1 Replies
Dec 25, 2010
Technology: ASP.NET 4.0, C#, forms/mvc
I am a .NET web designer and I wish to create a modular based website for people, similar to what DNN does (but I want to create my own cut down version).
The idea is that I create a base website that can 'activate' features which the client needs (and has paid for). These features may be used by many clients which require frequent future updates for all clients (so I wish to keep upgrade time down to a minimum).
For example, I upload the base web application using web deploy and it sets up the core database tables/views/SPs in the process.Then I login into the website as developer and activate the out of the box features that I wish to permit the user to take advantage of. The only way I can think of currently is via user control, resources etc..But I need a little of your experience and advice over what the possibilities / dangers are....
e.g. images for an application e.g. blog, that I have activated for a client - how do I reference those images
e.g. Can user controls be dynamically added to a web application (which is pre-compiled unlike a website - it must be a web application since I am using web deploy).
e.g. Modification of web.config to add additional routing (doesn't matter if app has to go down to do this).
I can upgrade websites features en-mass, rather than manually enhancing each individual website which given a certain amount of clients would result in an awful amount of time lost.I do not have access to sharepoint (nor do I intend to). how to automate modularity completely via a front end in asp.net would be superb! how to reference files and resources outside of the websites directory and without using virtual directories
View 1 Replies
Mar 4, 2010
need to turn off the cookies in my ASP.net site completely
I'm doing some funky stuff serving images and scripts from a .aspx file, which causes the request to have cookies tagged to it.
So, how do I get rid of these?
I've tried setting the SessionState mode="Off" in the web.config, but that didn't seem to work.
View 1 Replies
Jan 11, 2011
Is there any way to completely ignore line break and tab characters etc. in RegEx?
For instance, the line break and tab characters could be found anywhere and in any order in the content string.
[code].....
View 3 Replies
Aug 1, 2010
Our current web portal at work was a port from a classic ASP codebase. Currently, all pages in our project extend a custom Page class called PortalPage. It handles login/logout, provides access to a public User object for the currently authenticated user, and adds the standard page header and footer to all of our pages. Every Page in our site is 100% designed in the codebehind. The ASPX page is not used at all. Every single div, img, and block of text is allocated as an object and added from a C# function, even if it is completely static content (which we have a decent amount of). Example for a page header:
HtmlGenericControl wrapperDiv = new HtmlGeneric("div");
HtmlAnchor bannerLink = new HtmlAnchor();
HtmlImage banner = new HtmlImage();
bannerLink.HRef = "index.aspx";
banner.Src = "mybanner.png";
banner.Alt = "My Site";
bannerLink.Controls.Add(banner);
wrapperDiv.Controls.Add(bannerLink);
this.Page.Controls.Add(wrapperDiv);
Even worse, all Javascript is added to the page as a giant mess of string concatenations:
ClientScript.RegisterClientScriptBlock(this.GetType(), "javascript", @"
<script language='javascript'>
fullUrl = '" + ConfigurationManager.AppSettings["fullUrl"].ToString() + @"';.............
View 4 Replies
Oct 25, 2010
I am using Logout button in my pages.Logout button calls the Logout.aspx page. Logout.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
Session.Clear();
Response.Cookies.Clear();
Response.Redirect("default.aspx");
}
MyInbox.aspx.cs:
if ((string)Session["uname"] == null)
{
Response.Redirect("Logout.aspx");............
View 10 Replies