Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Linq and Validation Application Block (Enterprise Library)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Evert - 03 Feb 2008 14:16 GMT
Does anybody know if it is possible to use the Validation Application Block
from Enterprise Library 3.1 in Linq. The problem is that I don't know how to
add the validation attributes to the generated properties.

Thanks in advance,

Evert
Nicholas Paldino [.NET/C# MVP] - 03 Feb 2008 16:57 GMT
Evert,

   You can't through the designer.  There is no way to add attributes
through the designer to the classes.  You could modify the
designer-generated code, but it might be overwritten by the designer.

   There is no good solution to this, I am afraid.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Does anybody know if it is possible to use the Validation Application
> Block
[quoted text clipped - 5 lines]
>
> Evert
Evert - 03 Feb 2008 17:47 GMT
Hmm... I am searching for a good technology for my new application. (Sort of
time management on web). I thought the Validation Application Block was good
for my business objects. And LINQ to SQL is good for getting the data from
the database. But if it is not possible to use the VAB i can't use linq.

Do you have a better solution? I like the VAB a lot. It is easy to use, fast
to program and very sollid. With the AJAX validation controls it is also easy
to use in the GUI.

Best regards,

Evert

> Evert,
>
[quoted text clipped - 13 lines]
> >
> > Evert
Nicholas Paldino [.NET/C# MVP] - 04 Feb 2008 15:57 GMT
Evert,

   Well, there is no reason you can't code the objects that LINQ uses
yourself.  You can then apply whatever attributes you wish.  You can easily
create class definitions which LINQ can use.

   Here is a link to the section of the MSDN documentation titled "The LINQ
to SQL Object Model", which should help:

http://msdn2.microsoft.com/en-us/library/bb386989.aspx

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hmm... I am searching for a good technology for my new application. (Sort
> of
[quoted text clipped - 31 lines]
>> >
>> > Evert
Evert - 04 Feb 2008 17:07 GMT
Hi Nicholas,

Can you tell me what you mean with code myself? Do I need to code sort-of
copies of the LINQ entities that are created? How do I fill these entities?
Do I need to do this manually?

Br,

Evert

> Evert,
>
[quoted text clipped - 42 lines]
> >> >
> >> > Evert
Nicholas Paldino [.NET/C# MVP] - 04 Feb 2008 18:21 GMT
Evert,

   Yes, I am suggesting that you create the classes manually.  The entities
that the LINQ-to-SQL designer creates aren't special in any way, and there
is nothing that is preventing you from creating them yourself.  You just
have to have the proper attributes added to them which allow for the mapping
from the type to the database (the Table and Column attributes, mainly,
although I believe there are others).

   The link I pointed you to should show you how to attribute your own
classes to use with a DataContext instance and execute a LINQ query to
populate instances.

   Then, since you have control over the code, you can apply your own
validation attributes that you wish to apply.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi Nicholas,
>
[quoted text clipped - 61 lines]
>> >> >
>> >> > Evert

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.