Giter Site home page Giter Site logo

sharp-architecture's People

Watchers

 avatar  avatar  avatar

sharp-architecture's Issues

Session is not being closed if using IIS 7

Here's what WebSessionStorage should look like: 

        public class WebSessionStorage : ISessionStorage 
        { 
                private const string CurrentSessionKey = 
"nhibernate.current_session"; 


                public WebSessionStorage(HttpApplication app) { 
                        app.EndRequest += new EventHandler
(Application_EndRequest); 
                } 


                public ISession Session { 
                        get { 
                                HttpContext context = HttpContext.Current; 
                                ISession session = context.Items
[CurrentSessionKey] as ISession; 
                return session; 
                        } 
                        set { 
                                HttpContext context = HttpContext.Current; 
                                context.Items[CurrentSessionKey] = value; 
                        } 
                } 


                void Application_EndRequest(object sender, EventArgs e) { 
                        ISession session = Session; 


                        if (session != null) { 
                                session.Flush(); 
                                session.Close(); 
                                HttpContext context = HttpContext.Current; 
                                context.Items.Remove(CurrentSessionKey); 
                        } 
                } 
        } 


Here's how I'm setting it all up: 
        public class GlobalApplication : HttpApplication 
        { 
                public override void Init() { 
                        base.Init(); 
                        NHibernateSession.Init(new WebSessionStorage
(this), null); 
                        DaoContainer.Init(new AttributedDaoFactory()); 
                } 
     } 



Original issue reported on code.google.com by [email protected] on 11 Aug 2008 at 11:16

Code review request

Hi Billy, I've made a small change to the branch to show you how it works. 
Once you're fine with my change I'll merge it into the trunk.

After the review, I'll merge this branch into:
/trunk





Original issue reported on code.google.com by [email protected] on 26 Dec 2008 at 7:48

Mismatched Version Reference exceptions when using SharpArch dlls

What steps will reproduce the problem?
1. Copy the SharpArchitecture dlls to a lib folder of a new VS2008 project
2. Set up the project configuration files along the same lines as the
sample northwind project.
3. Add the references from the lib folder to the projects as required.


What is the expected output? What do you see instead?

Run the project - exceptions occur complaining that the there is a version
mismatch in the dlls, specifically for NHibernate 2.0.0.4000 and Ninject

NHibernate, Version=2.0.0.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located
assembly's manifest definition does not match the assembly reference.

Could not load file or assembly 'Ninject.Core, Version=0.4.3005.35587,
Culture=neutral, PublicKeyToken=c7192dc5380945e7' or one of its
dependencies. The located assembly's manifest definition does not match the
assembly reference. (Exception from HRESULT: 0x80131040)


What version of the product are you using? On what operating system?

SharpArchitecture_0.9.72.zip, Visual Studio 2008, Windows XP

Please provide any additional information below.

Using Reflector on the .dlls verifies that the dlls included with
SharpArchitecture that reference NHibernate/Ninject do indeed reference
older versions of Ninject and NHibernate than the NHibernate and Ninject
dlls included.

What I can't figure out is how the Northwind sample project manages to run
given all of these version mismatches...

Original issue reported on code.google.com by [email protected] on 14 Nov 2008 at 6:06

Repository.GetByProperties(...) does not handle null values properly.

What steps will reproduce the problem?
1. Put some data in the database with null for a nullable column.
2. Query by properties with the value as null
3. Note that the appropriate results are not returned.


What is the expected output? What do you see instead?
I expect the rows with the property set as null to be returned.


For example (somewhat psuedo),

Dictionary propetyCriteria = new Dictionary();

propertyCriteria.Add("Column1", "Value1")
propertyCiriteria.Add("Column2", null)

Repository<SomeClass> repo = new Repository()l

repo.GetByProperties(propertyCriteria);

With a table SomeClass with columns filled as

Column1   Column2
"Value1"    NULL

I would expect 1 row to be returned, but no rows are returned.


I think that GetByProperties needs to check if the value is null and add an
Expression.IsNull instead of a Expression.Eq


Original issue reported on code.google.com by [email protected] on 7 Jan 2009 at 5:33

Exception when referencing static content (image) in Northwind sample

What steps will reproduce the problem?
1. Add any image to the Northwind Sample project in the
Northwind.web/Content directory.
2. In Northwind.web/Views/Home/Index.aspx, reference the image like so:
<%= Html.Image("~/Content/YourImage.png") %>
3. Set a breakpoint in the global.asax in the Init() method.
4. Run the project
5. While loading the Index.asp page, the global.asax Init() will fire
twice.  The first time, all will go well.  The second time, you will get
the exception such as: 
{"Could not find file 'C:\\Documents and
Settings\\xxxxx\\Desktop\\SharpArchitecture_0.9.72\\src\\NorthwindSample\\Northw
ind.Web\\Content\\Hibernate.cfg.xml'.":"C:\\Documents
and
Settings\\xxxxx\\Desktop\\SharpArchitecture_0.9.72\\src\\NorthwindSample\\Northw
ind.Web\\Content\\Hibernate.cfg.xml"}


What version of the product are you using? On what operating system?

SharpArchitecture_0.9.72.zip, Visual Studio 2008, Windows XP

Please provide any additional information below.

It appears that the second time the Init() is fired, it's base directory is
in the content directory.  The problem can be fixed by modifying the
global.asax Init() to use ~/ as in the following:

        public override void Init() {
            base.Init();

            NHibernateSession.Init(new WebSessionStorage(this), 
                new string[] { Server.MapPath("~/bin/Northwind.Data.dll") }, 
                Server.MapPath("~/Hibernate.cfg.xml"));
        }

Original issue reported on code.google.com by [email protected] on 14 Nov 2008 at 10:34

Multiple Session Factories

I downloaded the source tonight and I think its very nicely done, however
from my understanding its not currently suitable to have multiple session
factories for two different databases. I trying to think of way to extend
the NHibernateSession to support this without violating the nice work. I'm
thinking of having NHibernateSession contain a static method with the
signature GetCurrent(Type aggregateRoot) and the generic DAO would call
GetCurrent(T) instead of .Current. Also for NHibernateSession to contain a
static ISessionResolver instance. I could then plug in whatever behaviour I
want - I'd implement ISessionResolver in my application solution to use
either programmatic dictionary, some config values about which
sessionfactory to use by resourceName.  


What do you think? 

Original issue reported on code.google.com by [email protected] on 11 Sep 2008 at 5:38

Missing MVC Project type GUID when creating new web project

Hi,
When using the VS template the web project is created nicely but the MVC 
project type GUID is missing.

{603c0e0b-db56-11dc-be95-000d561079b0}

currently:
<ProjectTypeGuids{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-
11d3-bf4b


should be:
<ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-
11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b

Thanks,
Noam

Original issue reported on code.google.com by [email protected] on 26 Jan 2009 at 7:49

Inconsistent VersionHistory and Guidelines documentation

The release notes and the Base_Architecture_and_Development_Guidelines.doc
are inconsistent.  The release notes for SharpArchitecture 0.9.114 state
that Ninject has been removed, and ControllersAutoBindModule has been
removed, yet the Guidelines.doc still reference both NInject and
ControllersAutoBindModule.

It would also be nice if the release notes were more thorough.  For
example, when you make a framework change, it would be nice to know *why*
you make the change, e.g. from NInject to Windsor.  What benefits does it
provide?  What were the tradeoffs?  I've started using NInject for other
injection needs not provided by S#arp architecture - are the benefits of
Windsor such that I might want to change DI containers their as well?

Original issue reported on code.google.com by [email protected] on 12 Dec 2008 at 8:58

IoC-powered entity classes

It would be great to be able to force NHibernate to instantiate entity
classes without a default constructor by using Injection of Control. For 

EXAMPLE:

public User : PersistentObject
{
    protected User(IPasswordPolicy passwordPolicy)
    {
    }
}

I don't see any way to let my User check the newly set password for
compliance with a given policy.

Maybe it is possible to use NHibernate with NInject for this?

Greets

J. Fritsch

Original issue reported on code.google.com by [email protected] on 19 Nov 2008 at 10:05

Mismatch mapping of validation results

Hi,
TransferValidationMessagesTo is wrongly create map value for Entity that 
was coming from nested viewdata.

for example:

if i have Controller view data as such (Event is from type Entity)

class EventViewData{
  Event EventEntity;
  bool isEditMode;
}

and i will call TransferValidationMessagesTo(ViewData.ModelState, 
[EventViewData object].Event) (lets say there is an errot in Title 
property of object type Event).

the method will try to map the object based on the context type + property 
which will be "Event.Title" where the MVC framework will have the map as 
EventEntity.Title.

The reason is that micosfot map it based ont he property name of the 
ViewData object which is EventEntity and shap architecture is not aware of 
this nested property.

Maybe the solution would be to allow prefix for the mapping and then 
remove the object type context from the begining of the mapping key.

hope its clear.

Thanks,
Noam

BTW great job i love the framework!!!

Original issue reported on code.google.com by [email protected] on 17 Jan 2009 at 9:21

Controllers grouped into "areas" should be supported

I'm working on a project using S#arp Architecture. There were a lot of
controllers in my project and is begin to hard to maintain.
For example, I have 22 component, such as Lifting Reporting, Back
Allocation Reporting, Lifting Data Management, Back Allocation Data
Management and so forth.

Each of the component I mentioned above have their own sub component
home, report by day, report by amount and many more,
where each of this have their own views. For example
BackAllocationReportingController and
the view is Views/BackAllocationReporting/Home.ascx, Views/
BackAllocationReporting/reportbyday.ascx and so forth. All controllers
in the Controllers directory and view is in Views Directory. And this is
veru confusing.

After browsing for a while, I found Phil Haack prototype about "Areas"
at http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx which
seems a nice solution for my problem.

But this is hard to implement with S#arp Architecture, because ninject
will throw error if I have two controllers with same name
(example HomeController for BackAllocationReporting and HomeController
for LiftingReporting).

Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 11:39

NHibernate Session inited multiple times - should not be initialized in Global.asax init?

It seems to me that in the Global.asax NHibernate Session is getting inited
multiple times. (I am currently trying to determine if this is the source
of a performance problem I am having where when running in IIS6 -- pages
randomly seem to take forever to load after the initial start).


According to http://msdn.microsoft.com/en-us/library/ms178473.aspx: Init()
is "Called
once for every instance of the HttpApplication class after all modules have
been
created. "

According to
http://msdn.microsoft.com/en-us/library/system.web.httpapplication.aspx: 

"Instances of the HttpApplication class are created in the ASP.NET
infrastructure,
not by the user directly. One instance of the HttpApplication class is used to
process many requests in its lifetime. However, it can process only one
request at a
time. Thus, member variables can be used to store per-request data."

Thus it seems to me that one HttpApplication object exists for every server
thread
processing requests.  So the Init will get called once for every server thread
processing requests.


Should the code:

NHibernateSession.Init(new WebSessionStorage(this), 
                new[] { Server.MapPath("~/bin/Northwind.Data.dll") },
                new AutoPersistenceModelGenerator().Generate());

be in the ApplicationStart event instead of the Init event?


(Note this is a follow up issue raised in comments of
http://code.google.com/p/sharp-architecture/issues/detail?id=18)

Original issue reported on code.google.com by [email protected] on 22 Jan 2009 at 4:59

Modify Equals/GetHashCode to reflect best ideas

http://devpinoy.org/blogs/joeycalisay/archive/2006/07/17/Overriding-Equals-
and-GetHashCode.aspx
http://devpinoy.org/blogs/joeycalisay/archive/2007/07/16/resharper-s-
gethashcode-and-the-number-29.aspx

Original issue reported on code.google.com by [email protected] on 2 Sep 2008 at 8:13

Crud Scaffolding fires when adding a project

What steps will reproduce the problem?
1. Use the template to generate a new solution
2. Add a new project to the solution
3. Crud Scaffolding will fire throwing a bunch of errors and generating a
large amount of garbage.

What is the expected output? What do you see instead?
The new project added to the solution with out triggering the Crud Scaffolding.

What version of the product are you using? On what operating system?
I am using trunk as of 1/13/2009 on Windows XP x64

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 14 Jan 2009 at 3:36

Strong named assemblies

We would like to have strong named assemblies for S#arp Architecture, 
because our application uses strong named assemblies and we need to 
reference signed assemblies for proper compilation.

Thanks.

Original issue reported on code.google.com by [email protected] on 16 Dec 2008 at 2:55

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.