Problems with Sharp Arch 1.9.6

174 views
Skip to first unread message

thecodefool

unread,
Mar 11, 2011, 10:16:41 AM3/11/11
to S#arp Architecture

Just want to say upfront that Sharp Rocks!


I have just downloaded the latest release 1.9.6.

I created a simple application

Created a database with one table in it defined as such (SLQ Server
2005)

GO

/****** Object: Table [dbo].[Person] Script Date: 03/11/2011
09:58:08 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Person](
[PersonId] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [varchar](50) NOT NULL,
[LastName] [varchar](50) NOT NULL,
[BirthDate] [datetime] NOT NULL,
CONSTRAINT [PK_Person] PRIMARY KEY CLUSTERED
(
[PersonId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY
= OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


I created a Person Object with the ScaffoldingGeneratorCommand.tt

I just called it Person and commented out the reference to
/*entityScaffoldingDetails.EntityProperties.Add(
new EntityProperty("Manager", "Employee", null, "[NotNull]")
);*/

The Generated class looks like this:
public class Person : Entity{
[DomainSignature]
[NotNull, NotEmpty]
public virtual string FirstName { get; set; }

[DomainSignature]
[NotNull, NotEmpty]
public virtual string LastName { get; set; }

public virtual DateTime BirthDate { get; set; }
}


Now everythihng works and builds fine, I had to tweak the Conventions
a bit (Which I had to always do) but other than that no real change.


Two issues:

1. When I go into MySite/People/Create I get
Validation type names in unobtrusive client validation rules must be
unique. The following validation type was seen more than once:
required
Line 21: <div><%= Html.TextBoxFor(m => m.Person.FirstName) %></div>

I can either remove the NHibernate Validator Constraints (which I do
not want to do, I created an old app with Sharp 1.5 and love these
things, or is there a better way??)
or in the web.config.
<appSettings>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
Setting these to false fixes the first issue.

However I would like to know what I really should do, what does the
group recco.



2. Once the first issue is fixed, I try a simple add and I get:
No component for supporting the service
SharpArch.Core.CommonValidator.IValidator was found
Line 46: if (ViewData.ModelState.IsValid &&
person.IsValid()) {

If I go into the CastleWindsor/ComponentRegistrar.cs and change the
reference from:
using NHibernate.Validator.Engine;
To:
using SharpArch.Core.CommonValidator;

All works fine.

Is this a glitch, or did I do something stupid?

Any help is appreciated.

Thanks

Alec Whittington

unread,
Mar 11, 2011, 6:07:00 PM3/11/11
to sharp-arc...@googlegroups.com
Would there be anyway you could pack up the code and post a link to download it. I've not come across either of these errors before, but would be interested in coming up with a solution for you. I will be out of town this weekend, so Tuesday would be the earliest I could look at this (Maybe Sunday evening depending on when we get home).

Alec


--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To post to this group, send email to sharp-arc...@googlegroups.com.
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sharp-architecture?hl=en.


The CodeFool

unread,
Mar 11, 2011, 6:40:22 PM3/11/11
to sharp-arc...@googlegroups.com

Sure thing I will send tomorrow at the latest.

Thanks for the help

thecodefool

unread,
Apr 8, 2011, 12:57:57 PM4/8/11
to S#arp Architecture
Thanks to Hamidreza Nafar <ha...@webious.ca>
for pointing out to me that I did not post the answer :).

I thought the whole thing was captured here but I sent an email
directly to Alec and all went awry

Anyway:

After talking with Alec (and I am paraphrasing as I deleted his email
- duh ),

You must set in web.config
<appSettings>
<add key="ClientValidationEnabled" value="false"/>
<add key="UnobtrusiveJavaScriptEnabled" value="false"/>
</appSettings>

And:
in CastleWindsor/ComponentRegistrar.cs change the
reference from:
using NHibernate.Validator.Engine;
To:
using SharpArch.Core.CommonValidator;

All will work.

I "think" that Alec had said that it was due to the fact that he had
not messed with the scaffolding generator in a while (around this
issue)
and would fix in a future fix.

Alec, if I misquoted, my sincere apologies, as I think you are da
man! , sorry for deleting the original email it was a mistake.

Thanks again Alec.


On Mar 11, 7:40 pm, The CodeFool <thecodef...@gmail.com> wrote:
> Sure thing I will send tomorrow at the latest.
>
> Thanks for the help
> On Mar 11, 2011 6:07 PM, "Alec Whittington" <alec.whitting...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > Would there be anyway you could pack up the code and post a link to
> download
> > it. I've not come across either of these errors before, but would be
> > interested in coming up with a solution for you. I will be out of town
> this
> > weekend, so Tuesday would be the earliest I could look at this (Maybe
> Sunday
> > evening depending on when we get home).
>
> > Alec
>
> > On Fri, Mar 11, 2011 at 8:16 AM, thecodefool <thecodef...@gmail.com>

Alec Whittington

unread,
Apr 8, 2011, 1:33:07 PM4/8/11
to sharp-arc...@googlegroups.com, thecodefool
Thanks for the kind words Tony. I think you summed it up. This will get fixed with I rewrite the Scaffolding generator.

Alec
Reply all
Reply to author
Forward
0 new messages