Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gavinbarton

Pages: [1]
1
General Board / Modelling array as a type
« on: June 18, 2007, 02:48:17 am »
I am trying to illustrate that a parameter being passed into a method is an array.

I can create a class and set the cardinality of the class to 0..*.  However if I then reference this class as the type of my parameter in my method it appears as:

void MyMethod(myParameter)

rather than

void MyMethod(myParameter[])

How can I achieve the [] without actually typing it?

Thanks

2
Automation Interface, Add-Ins and Tools / Re: Code Template
« on: July 11, 2007, 02:07:40 pm »
thanks again.

3
Automation Interface, Add-Ins and Tools / Re: Code Template
« on: July 11, 2007, 01:17:25 pm »
Thanks that worked a treat.

Is there anyway in store additional custom properties on an 0peration.  In my example I have a stored procedure name, if I can set it as a custom property then the template can pick it up and included it.

I look at the alias but I dont think this would be suitable.

Thanks for the help

4
Automation Interface, Add-Ins and Tools / Code Template
« on: July 11, 2007, 12:30:13 pm »
I have been using the CTF in EA 7 to create code however I have hit a wall with looping and parameters. I would like to create a code template that utilises the parameters defined in an operation.  

For example, I have an operation defined as:

public DataSet GetName(string Name, string Address)
{

   Database db = DatabaseFactory.CreateDatabase();
   DbCommand cmd = db.GetStoredProcCommand("search");

   db.AddInParameter(cmd, "Name", DbType.String, Name);
   db.AddInParameter(cmd, "Address", DbType.String, Address);

   return db.ExecuteDataSet(cmd);
}

The built in templates produce the following:

public DataSet GetName(string Name, string Address)
{
   return null;
}

I can easily add in:

public DataSet GetName(string Name, string Address)
{

   Database db = DatabaseFactory.CreateDatabase();
   DbCommand cmd = db.GetStoredProcCommand("search");

   return db.ExecuteDataSet(cmd);
}

I would like to create a CTF operation template to process the parameters so that for each parameter it adds:

   db.AddInParameter(cmd, %ParamName%, %DBType%, %ParamName%);

The template for the method would be:

public DataSet OperationName(params)
{
   Database db = DatabaseFactory.CreateDatabase();
   DbCommand cmd = db.GetStoredProcCommand(%SP_NAME%);

   foreach(param in params)
   {
      db.AddInParameter(cmd, %ParamName%, %DBType%, %ParamName%);
   }

   return db.ExecuteDataSet(cmd);

}


In the EA guide an example uses %list="Parameter" @separator=", "% to fetch all of the parameters but there appears to be no looping mechanism to loop through each parameter so that I can:
1) Work out the type
2) Grab the name

The second thing that I would like to work out is if there is a way to pass in variables for a particular operation.  For example the operation could have a stored procedure naame associated to it.

Any help with the above would be greatly appreciated.

Thanks,
Gavin




Pages: [1]