Code Snippet Editor
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Code Snippet EditorExpand / Collapse
Author
Message
Posted 10/13/2007 2:42:14 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Yesterday @ 6:22:41 PM
Posts: 106, Visits: 392
This may fall into the category of "Well, duh!" but just in case anybody is lower on the learning curve than I am :

There is an extremely cool code snippets editor on the tools menu of VS.  Basically is adds stuff to intellisense.

I created a new folder for Strataframe snippets.  Here is an example of a Custom Field Property snippet

( this is instead of cutting and pasting from the bo.designer generated code as in the beginner tutorial. Note that the string datatype is hardcoded so either make a $replacement$ for it or remember to change it if your custom field prop isn't string 

#Region " Custom Field Properties "

''' <summary>

''' $Custom Field Description$

''' </summary>

''' <remarks></remarks>

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("$Custom Field Description$"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property [$Property Name$]() As System.String

Get

Return $Property Value$

End Get

End Property

Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()

'-- Create and return a new array of FieldPropertyDescriptor

' objects that contains the ReflectionPropertyDescriptor

' for the $Property Name$ field.

Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _

New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _

"$Property Name$", GetType($BOName$))}

End Function

#End Region

On the Imports tab you enter the stuff that must be imported for this to work

System.ComponentModel

Microfour.Strataframe.UI.Windows.Forms

For a shorcut I used cpr

Now if you are in the BO code, you just but the cursor under the Event Handlers region, type cpr, hit tab and everthing you see above gets typed in with the cursor on the first Replacement.  You fill it in, tab to the next one etc.

If the imports statements are not at the top of the declaration, the snippet editor puts them in !

I think this is cool and I'm pretty sure I've only scratched the surface of the possiblities here.

You may not see the Code Snippet Editor on the Tools menu ( for some reason mine didn't have it ) but if you Google you'll find it for download with easy instructions to install in.  Comes with a lot of predone VB stuff as well.

I've added

FillbyParam ( fbp )

Public Sub Fillby$Subname$(ByVal $param1$ As String)

'-- Establish locals

Dim loCommand As New SqlCommand()

'-- Build the query

loCommand.CommandText = "SELECT $Fieldlist$ FROM $tablename$ WHERE $param1$ like @$param1$+'%'"

'-- Add the parameter

loCommand.Parameters.Add("@$param1$", SqlDbType.NVarChar)

loCommand.Parameters("@$param1$").Value = $param1$

'-- Execute the command to fill the business object

Me.FillDataTable(loCommand)

End Sub Fillby$Subname$

MessageboxYesNo '

Dim dr As DialogResult = _

MessageBox.Show("$Message$","$Heading$", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)

If dr = Windows.Forms.DialogResult.Yes Then

End if

( sorry for the blank lines but I can't figure out how to turn off big line spaces after pasting code )

Would like to see what you guys who know a lot more about this stuff are doing with snippets 

Charles

 

 

 

Post #11963
Posted 11/07/2007 6:44:38 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 6:42:41 PM
Posts: 1,058, Visits: 2,581
no kidding..."Duh"...I can't believe I didn't think of this! (smacks head on desk)



Thanks!
Post #12548
Posted 11/12/2007 8:42:15 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 05/08/2008 4:00:06 PM
Posts: 69, Visits: 249
Very cool Charles. Thanks for posting this. So, have you got to the point where you say "Yuck!" when you have to go back to VFP? (I'm still not there yet but gradually I'm seeing the coolness of the VS IDE)
Post #12634
Posted 11/13/2007 6:20:43 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Yesterday @ 6:22:41 PM
Posts: 106, Visits: 392
Hey Randy

Well, I'm certainly to the point when I go back to the VFP debugger it is like looking at the FPW 2.6 debugger from VFP.

You and I have been spoiled in VFP by using VFE ( which has great design similarity with SF ). We've been using objectified data, SQL backends and business objects for years.

But I see from VB .NET books that there are a lot of .NET folks doing the equivalent of writing table based 2 tier VFP apps. I think SF is going to keep us going in the direction of best-practices in .NET the way VFE does in VFP.

I'm still having a little trouble warming up to .NET's idea of inheritance, but there are some cool parts ( partial classes ) that make it just different, not necessarily inferior.

The one thing I'm finding still weak in the .NET world ( though it probably has a lot to do with my incomplete understanding of the underlying architecture ) is data-driving processes - especially what appears to be the absence of a data dictionary on the level of DBCX2. I'm hoping the SF DDT evolves in that direction.



Post #12638
Posted 03/12/2008 3:56:23 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 03/14/2008 6:37:17 PM
Posts: 3, Visits: 10
Wow.... very cool seeing some familiar names from the VFE forum... making me think we're doing the right thing by looking at SF..

Any tips? Funny Charles' comment about the DBCX... we've started having discussions about the various frameworks we're looking at and I had mentioned that the lack of an active data dictionary is not so cool... Guess two steps forward one step back (tell me it's not the other way).

By the way, did you guys look at any other frameworks (e.g., CSLA or devForce)?

________________
_____/ Regards,
____/ al
Post #14828
Posted 03/12/2008 4:11:24 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
Guess two steps forward one step back (tell me it's not the other way).

We too are from a VFP background and used to rely heavily on data dictionaries...which in our medical application we are doing everything that we can to get away from it!  There are better (and more efficient) ways of accomplishing the same thing in .NET.  One thing that most developers moving over from VFP have a hard time initially grasping is disconnected data.  When we were developing in VFP, you opened a table and BOOM...all of your records were there.  Even if you were using views it still had to bring the data to the client to do the work since there was not a server.

Relying heavily on a data dicitonary in a disconnected data application (which will be any application from this point forward) can create a slow and unresponsive application.  Thus most develpoers take a different approach.  It took us a while when we first stepped into .NET and disconnected data from VFP because we were trying to basically use the same techniques on a new technology....which just won't work...and it shouldn't.

I think that as you move forward you will discover hundreds of new things that will make your life much easier and better...so though at first glance it appears as though there has been a step back or two, that is just because we have generally been trying to look at it from the same perspective as when we were developing in VFP when there is ultimately a better and more efficient way in .NET.

Post #14830
Posted 03/13/2008 10:44:46 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 03/14/2008 6:37:17 PM
Posts: 3, Visits: 10
Good Morning, Trent -

Out with the old, in with the new. I like it!

Post #14841
Posted 03/14/2008 10:56:10 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 03/14/2008 6:37:17 PM
Posts: 3, Visits: 10
Good Morning!

After working with the trial a bit and comparing it to Visual FoxExpress and a custom framework that I've worked with in the past I wanted to discuss a bit further the use of an active Data Dictionary v. the BO Mapper to set properties and behavior for columns in a table. My most pressing concern has to do with the thought that setting these properties at the BO level can lead to the need to repeat the process for any "new" BOs that are created for the same table. Is that the case, or does the "*designer" file hold this metadata and therefore can be reused for other BOs that need it?

Also, (and this may reflect my ignorance of SF), VFE has a data layer that allows for PEMs at the column, cursor and DataEnvironment levels. Is there something similar in Strataframe?

Thanks.
Post #14887