VB Templates

Developer
Jun 29, 2011 at 9:45 PM

Tiago,

I said a while ago that I was interested in converting the templates to output VB. However because of all the changes you have been making to the templates I have been ignoring this. I was wondering whether you consider the templates to be stable enough now for me to start looking at the conversion.

Regards,

Bill

Coordinator
Jul 1, 2011 at 7:49 PM
Edited Jul 1, 2011 at 11:36 PM

Hi Bill,

I took some time to write an answer because I wanted to evaluate what needs to be done for CSLA4 target (CSLA4DAL is another story):

Small changes/easy to do

  • DynamicEditableRoot/DynamicEditableRootCollections is done (needs testing like some other stereotypes in the test list)
  • 381 - Rules - Support for DataAnnotations (validation rules)
  • 454 - Add "Implements" and "Attributes" for child collection and non-collection properties
  • 370 - Implement "MarkDirtyOnChange" property option
  • 369 - Implement [NonSerialized] on fields

Ignore for now

  • 523 - Templates for Updater and Deleter Unit of Work pattern
  • 189 - Correct templates for EditableSwitchable

Not easy

  • 516 - Implement BypassPropertyChecks code blocks - shouldn't be easy
  • 360 - Allow use of PropertyInfo default value AND DataPortal_Create
  • BusinessRules
  • Criteria as CriteriaBase and as BusinessBase

There will always be changes and improvements. But I guess you are right. After this big refactoring the templates are more stable and it's easier to isolate the changes. I say the time is right to to move on to VB templates.

Go ahead Bill. And thank you.

Developer
Jul 12, 2011 at 4:56 PM

Hi Tiago,

I was having a look through the first few templates and noticed that the code around line 137 of BusinessProps

                if (setNewValue)
                {

looks like there is some coding missing.

Regards,

Bill

Coordinator
Jul 13, 2011 at 9:15 AM

This is an inheritance from CSLA2. Presently I deleted these lines, but I must go back and find out what they were used for.

Coordinator
Aug 9, 2011 at 9:47 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Sep 11, 2011 at 3:42 PM

This code is used only on ByteArray properties that are not read only. What is does, is checking the new byte[] is indeed different from the existing one. I guess the intention is to avoid saving to the database something that is already there.

public Byte[] Picture
{
    get
    {
        CanReadProperty("Picture", true);
        return _picture;
    }
    set
    {
        CanWriteProperty("Picture", true);
        bool setNewValue = false;
        if (value != null && _picture == null)
            setNewValue = true;
        if (!setNewValue && value != null && _picture != null)
        {
            if (_picture.Length != value.Length)
            {
                setNewValue = true;
            }
            else
            {
                for (int i=0; i < value.Length; i++)
                {
                    if (value[i] != _picture[i])
                    {
                        setNewValue = true;
                        break;
                    }
                }
            }
        }
        if (setNewValue)
        {
            _picture = value;
        }
    }
}

Apr 20, 2012 at 1:50 PM

Has there been any progress in generating 4.0 VB Templates?  Just checking to see if anything has changed with this.

 

Thanks,

Mike

Coordinator
Apr 20, 2012 at 11:24 PM

Hi Mike,

I'm afraid there wasn´t any progress. I need volunteers for this task. I guess Bill didn't find time to do it. Are you proposing yourself to do the job?

Regards,

Tiago Freitas Leal