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 / Visual Studio.NET / Extensibility / February 2006

Tip: Looking for answers? Try searching our database.

Automatic Parser and Class Generation Add-In

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ludovic DE FREITAS - 16 Feb 2006 06:17 GMT
Hello,

I post a new message because I am novice in Visual Studio Add-In and I
cannot found any help to do what I need, except standard samples to create a
item in menu that lunch a command.

I am building a data access framework and I would like to create an Add-In
in Visual Studio that handle any changes in project files of given type
(exemple: "*.requests"), then, parse the file and generate a class in project
that is automatically available for intellisense.

Now a example:
In file "Client.requests", programmers write all SQL needed to manage
Client. The content of the file is something like that:
----------------------------------------
LoadClient,"Select * From Client Where ClientId = @ClientId"
LoadClientRegion,"Select * From Client Where RegionCode = @RegionCode"
LoadGoodClient,"Select TOP 10 * From Client OrderBy TotalAmount Desc"
DisableClient,"Exec DisableClient @ClientId"
...
----------------------------------------

When the file is saved, I would like the Add-In parse the file and generate
a .cs file like that:
----------------------------------------
public class LoadClient : DataAccessBase {
 public LoadClient() {
   this.Sql = "Select * From Client Where ClientId = @ClientId"
 }

 public object ClientId {
   get { return this.Params["ClientId"]; }
   set { this.Params["ClientId"] = value; }
 }
}

public class LoadClientRegion : DataAccessBase {
 public LoadClientRegion () {
   this.Sql = "Select * From Client Where RegionCode = @RegionCode"
 }

 public object RegionCode {
   get { return this.Params["RegionCode"]; }
   set { this.Params["RegionCode"] = value; }
 }
}

...
----------------------------------------

The parsing mechanism is already created but I need to integrate it in
Visual Studio like explain before.

Can somebody help me to start ?

Thanks.
Carlos J. Quintero [VB MVP] - 16 Feb 2006 09:06 GMT
Hi Ludovic,

If you want to do something when a document is saved, take a look at the
EnvDTE.DocumentEvents.DocumentSaved(...) event.

Also, you have lots of resources and HOWTO articles about add-ins in a
section of my web site (below).

Signature

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

> Hello,
>
[quoted text clipped - 55 lines]
>
> Thanks.

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.