Visual Studio Add In


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
I wrote this add-in to save myself some time while working on a project I am doing that has lots of lookup tables and views. It took me a bit longer that I thought but it was interesting.I think it's a useful utility and add-in example to share with all of you. Hope it helps

I put this together LATE last night and finshed tonight so beware Smile there might be a mosquito just waiting to stingBigGrin.

I added a few screenshots, a zip with the source andv a zip containing the addin and the .dll you can just unzip to your C:\Documents and Settings\[username]\My Documents\Visual Studio 2008\Addins or wherever you addins directory is.

Gotta go Enjoy

Paul

Currently to set up a bo

1.Add each business object(s)  to VisualStudio--- for 10 Bo's do this step 10 times

2.Launch the business object mapper

3.Configure the project

4.Configure the each Business Object--- for 10 Bo's do this step 10 times

5. Build the partial class(s). You would select the table and views you wich to create 

With Add In

1. Launch BoGenerator

2.Configure project (Same as step 3 above)

3.Select multiple Table(s) and View(s) from list.

4.Generate Business Object --- for 10 bo's it add's all 10 bo's to project and also configures the business object

5.Auto Launches the bo mapper then Build Partial Classes (Same as step 5)

Attachments
mainform.png (540 views, 34.00 KB)
mainformtables.png (514 views, 41.00 KB)
source.zip (439 views, 988.00 KB)
Addin.zip (432 views, 46.00 KB)
Replies
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Hi Alex,

It has been awhile since I made the add-in I mainly made it for a project that had a lot of existing lookup tables and such. I think what is happening to you is you don't have a project selected in the solution, when the addin goes to create the business object it creates it in the project that is selected in soultion explorer. I had a look at the code and that is probably the problem.I checked for the possibility that the project wasnt selected but did not show the error and exit the sub like a I should have.

To verify make sure you have the project you want to create the business objects in selected in solution explorer prior to generating business objects and it should work ok. I will fix the code and repost it if I get a chance later today or you can make the change it is in the following method.

Private Sub CreateAndAddBusinessObjects()

 

Paul

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Actually here is the Corrected Code, figured might as well do it while i had it open

Private Sub CreateAndAddBusinessObjects()

'Variables

Dim LcTableName, Lcfilename As String

If Me.ListView_Views.CheckedItems.Count + Me.ListView1.CheckedItems.Count = 0 Then

'nothing selected

Exit Sub

End If

'Make sure we have a project

Try

If Not _Project Is Nothing Then

' I could probably make this a bit more dynamic but it works

For Each loitem As ListViewItem In Me.ListView1.CheckedItems

LcTableName = loitem.Text

Me.SqlTableSchema.NavigateToPrimaryKey(LcTableName)

Lcfilename = Me.TxtPreFix.Text & LcTableName & TxtSuffix.Text & ".vb"

If GenerateBusinessObject(Lcfilename) Then

Me.WaitWindow1.ShowWaitWindow("Adding Table " & Lcfilename)

CreateDTE_ProjectItems(SqlTableSchema)

Else

Me.WaitWindow1.ShowWaitWindow("Failed to Add " & Lcfilename)

End If

Me.WaitWindow1.HideWaitWindow()

Next

For Each loitem As ListViewItem In Me.ListView_Views.CheckedItems

LcTableName = loitem.Text

Lcfilename = Me.TxtPreFix.Text & LcTableName & TxtSuffix.Text & ".vb"

Me.SqlViewSchema.NavigateToPrimaryKey(LcTableName)

If GenerateBusinessObject(Me.TxtPreFix.Text & LcTableName & TxtSuffix.Text & ".vb") Then

Me.WaitWindow1.ShowWaitWindow("Adding View " & Lcfilename)

CreateDTE_ProjectItems(SqlViewSchema)

Else

End If

Me.WaitWindow1.HideWaitWindow()

Next

Else

'Warn User

MessageBox.Show("You must Select a Project in the Solution Explorer!!", "", MessageBoxButtons.OK, MessageBoxIcon.Error)

'Make sure wait window is hidden

Me.WaitWindow1.HideWaitWindow()

'get outta here

Exit Sub

End If

If MessageBox.Show("All Business Objects have been created " & vbCrLf & vbCrLf & "Would you like to run the business object mapper now?", "Business Object Generator", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) = System.Windows.Forms.DialogResult.Yes Then

Me.ShowBOMapper()

End If

Me.Close()

Catch ex As Exception

Finally

Me.WaitWindow1.HideWaitWindow()

End Try

End Sub


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Paul Chase - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Edhy Rijo - 17 Years Ago
Alex Luyando - 17 Years Ago
Alex Luyando - 17 Years Ago
Paul Chase - 17 Years Ago
Paul Chase - 17 Years Ago
Alex Luyando - 17 Years Ago
Paul Chase - 17 Years Ago
Alex Luyando - 17 Years Ago
Paul Chase - 17 Years Ago
Larry McIntosh - 17 Years Ago
Paul Chase - 17 Years Ago
Larry McIntosh - 17 Years Ago
Alex Luyando - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search