StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


««12

Visual Studio Add InExpand / Collapse
Author
Message
Posted 12/12/2008 10:54:01 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 07/14/2010 2:48:32 PM
Posts: 403, Visits: 2,798
Morning Alex,

Godd to hear that you got it working ok I am glad that it might help you out.

Have a good one

Paul

Post #21163
Posted 12/15/2008 8:23:01 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:16:53 PM
Posts: 78, Visits: 587
Hi all -

Thought I'd post the modified version of GenerateBusinessObject() which I am using for C# projects, so that anyone who may be able to benefit from this great Add-in can do so.

Hope this helps, and thanks again, Paul!
________________
_____/ Regards,
____/ al


Private Function GenerateBusinessObject(ByVal FileName As String) As Boolean
'-- Variables
Dim loStartEditPoint As EditPoint
Dim loEndEditPoint As EditPoint
Dim loTextDocument As TextDocument
Dim lodocument As Document
Dim loProjectItem As ProjectItem

'-- Make Sure We ar on the Correct Project
GotoProject(_Project.Name)
' Check to see if file exists
'---
If System.IO.File.Exists(_Project.FullName.Substring(0, _Project.FullName.LastIndexOf("\"c)) & "\" & FileName) Then
If ChkOverwrite.Checked Then
System.IO.File.Delete(_Project.FullName.Substring(0, _Project.FullName.LastIndexOf("\"c)) & "\" & FileName)
Else
Return False
End If
End If


'-
Try
loProjectItem = _Project.DTE.ItemOperations.AddNewItem("Visual C# Items\SF Business Object", FileName)
'// 12-11-2008 AEL: loProjectItem = _Project.DTE.ItemOperations.AddNewItem("Common Items\SF Business Object", FileName)

'Get Ref to New bus obj
lodocument = _Project.DTE.ActiveDocument

loTextDocument = DirectCast(lodocument.Object, TextDocument)

' Create edit point
loStartEditPoint = loTextdocument.CreateEditPoint()

'// [START] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= AEL Mod. 12-12-2008 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= [START]
'//
'loStartEditPoint.MoveToLineAndOffset(7, 5)

'' Create edit point at the end of Document
'loEndEditPoint = loStartEditPoint.CreateEditPoint
'loEndEditPoint.EndOfLine()
'Delete Original Line and replace with the Inherits Statement on Text Box
'// 12-12-2008 AEL: loStartEditPoint.Delete(loEndEditPoint)
'// 12-12-2008 AEL: loStartEditPoint.Insert("Inherits " & Me.txtinherits.Text)

loStartEditPoint.MoveToLineAndOffset(13, 1) ' Start of partial class declaration for the new BO
If loStartEditPoint.FindPattern(":") = False Then
MsgBox("Error: Did not find ':' in partial class declaration! Could not change inheritance to custom BO class!!")
Return False
Else
'' Create edit point at the end of Document
loEndEditPoint = loStartEditPoint.CreateEditPoint
loEndEditPoint.EndOfLine()
'Delete Original Line and replace with the Inherits Statement on Text Box
loStartEditPoint.Delete(loEndEditPoint)
loStartEditPoint.Insert(": " & Me.txtinherits.Text)
End If

'//
'// [END] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= AEL Mod. 12-12-2008 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= [END]

'Close The Document
lodocument.Close(vsSaveChanges.vsSaveChangesYes)
Return True
Catch ex As Exception
MessageBox.Show("Exception Thrown: " & ex.Message)
Return False
End Try

End Function



________________
_____/ Regards,
____/ al
Post #21179
Posted 12/16/2008 3:21:23 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 2 days ago @ 8:23:54 AM
Posts: 3, Visits: 196
The BO Generator suddenly stopped working for me and eventually I tracked it down to DevExpress.  I had installed an Evaluation copy after using the BO Generator successfully and it then would only create the first GO and gave an error for all the rest (Template not valid for project).

A "Solution Items" folder was being created automatically when the BO Generator ran and it seemed to select this new folder somehow after the first BO was created and failed for every subsequent BO.  I couldn't figure out how to stop the creation of the "Solution Items" folder so I un-installed DevExpress.  Projects created when DevExpress was installed would still not work (kept creating the "Solution Items" folder).  But if I re-created the project (without DevExpress installed), the BO Generator worked perfectly and the "Solution Items" folder did not appear.

I'm a newbie to .Net so someone may know how to stop the creation of the "Solution Items" folder but I couldn't.

Post #21201
Posted 12/16/2008 10:28:46 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 07/14/2010 2:48:32 PM
Posts: 403, Visits: 2,798
Hi Larry,

That sounds strange I have and use Dev-Express and have not run into any issues like the one you describe.

What version of Dev-Express are you using? Is it an Evaluation version ?

Where is "Solution Items" folder you are talking about being created? is it in the project iself or what?

Post #21217
Posted 12/16/2008 5:12:31 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 2 days ago @ 8:23:54 AM
Posts: 3, Visits: 196
Yes, it was an Evaluation version of DevExpress and I have no idea what the Solution Items folder is used for.  The Solution Items folder is a virtual folder that appeared directly under the Solution Title node at the top of the solution explorer when the BO Generator was running.  I found references to it in the DevExpress forum about problems it was causing when converting VS2005 to VS2008.  It also seemed to disappear when the solution was closed and re-opened.  I assume that the BO Generator is linked to the project by PK and since the Solution Items folder was created about the real project, it got the project PK previously assigned to the real project.
Post #21240
« Prev Topic | Next Topic »

««12

Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Trent L. Taylor, Dustin Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 11:27am

Powered by InstantForum.NET v4.1.4 © 2010
Execution: 0.047. 8 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.