public void TestInteractionHandlesWithoutQualifiedName() { try { JoinFederation(); IInteractionClassHandle commHandle = rtiAmbassador.GetInteractionClassHandle("Communication"); IParameterHandle messageHandle = rtiAmbassador.GetParameterHandle(commHandle, "message"); string messageName = rtiAmbassador.GetParameterName(commHandle, messageHandle); Assert.AreEqual("message", messageName); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error(e.Message); } Assert.Fail("Unexpected exception while fetching the object model handles:" + e); } // clean up for the next test Resign(); }
//private HLAInteractionParameter parameter; /// <summary> /// Constructor. /// </summary> /// <param name="pName">the name of the parameter /// </param> public ParameterDescriptor(System.String pName, IParameterHandle pHandle) { //parameter = new HLAInteractionParameter(); //TODO. Fullfill the native type!! this.Name = pName; handle = pHandle; }
public static int ExecuteNonQuery(IConnectionHandle handle, string query, object[] parameterValues, IParameterHandle[] extraParameters) { ConnectionHandle connection; DbTransaction transaction; DbCommand command; DbParameter parameter; int numberOfRows; connection = (ConnectionHandle)handle; transaction = ((TransactionHandle)connection.TransactionHandle).Transaction; command = connection.Factory.CreateCommand(); command.CommandText = query; command.Connection = connection.Connection; command.Transaction = transaction; if (parameterValues != null) { for (int i = 0; i < parameterValues.Length; i++) { object paramValue = parameterValues[i]; //Datetime mapping if (paramValue is DateTime && DateTime.MinValue.Equals((DateTime)paramValue)) paramValue = DBNull.Value; //null mapping if (paramValue == null) paramValue = DBNull.Value; parameter = connection.Factory.CreateParameter(); parameter.ParameterName = "prm" + i; parameter.Value = paramValue; command.Parameters.Add(parameter); } } if(extraParameters!=null) foreach (ParameterHandle p in extraParameters) { if (p == null) continue; command.Parameters.Add(p.Parameter); } numberOfRows = command.ExecuteNonQuery(); return numberOfRows; }
/// <summary> /// Returns the descriptor for the parameter with the given handle. First /// searches the parameters of this class, then the parameters of the /// parent classes. /// </summary> /// <param name="handle">the handle of the parameter /// </param> /// <returns> the parameter descriptor, or <code>null</code> if no such /// descriptor exists /// </returns> public virtual ParameterDescriptor GetParameterDescriptor(IParameterHandle handle) { ParameterDescriptor pd = parameterHandleDescriptorMap[handle]; if (pd != null) { return(pd); } else { System.Collections.IEnumerator it = parentDescriptors.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratorhasNext_3"' while (it.MoveNext() && pd == null) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratornext_3"' pd = ((InteractionClassDescriptor)it.Current).GetParameterDescriptor(handle); } return(pd); } }
/// <summary> /// Returns the descriptor for the parameter with the given handle. First /// searches the parameters of this class, then the parameters of the /// parent classes. /// </summary> /// <param name="handle">the handle of the parameter /// </param> /// <returns> the parameter descriptor, or <code>null</code> if no such /// descriptor exists /// </returns> public virtual ParameterDescriptor GetParameterDescriptor(IParameterHandle handle) { ParameterDescriptor pd = parameterHandleDescriptorMap[handle]; if (pd != null) { return pd; } else { System.Collections.IEnumerator it = parentDescriptors.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratorhasNext_3"' while (it.MoveNext() && pd == null) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratornext_3"' pd = ((InteractionClassDescriptor)it.Current).GetParameterDescriptor(handle); } return pd; } }
public static object Insert(object entity) { Type type; PersistenceStrategy strategy; string tableName, sql, idSql, paramPrefix, paramSuffix; string[] fieldNames, parameterNames; object[] fieldValues; int i; IParameterHandle idParam = null; IdMethod idMethod; object idValue = 0; //!!! bu kodun -entity içindeki deðerler alýnmadan- önce çalýþmasý lazým. IInsertInfo iInfo = entity as IInsertInfo; if (iInfo != null && GetValue != null) { iInfo.InsertUser = (int)(GetValue("Kullanici_Id") ?? 0); iInfo.InsertDate = DateTime.Now; } type = entity.GetType(); strategy = PersistenceStrategyProvider.FindStrategyFor(type); paramPrefix = Transaction.SqlHelper().ParameterPrefix(); paramSuffix = Transaction.SqlHelper().ParameterSuffix(); tableName = strategy.GetTableNameOf(type); fieldNames = strategy.GetInsertFieldNamesOf(type); parameterNames = StrHelper.GetNumbers(0, fieldNames.Length); parameterNames = StrHelper.Concat(paramPrefix, parameterNames, paramSuffix); fieldValues = strategy.GetFieldValuesOf(entity, fieldNames); sql = Transaction.SqlHelper().BuildInsertSqlFor(tableName, fieldNames, parameterNames); idMethod = strategy.GetIdMethodFor(type); switch (idMethod) { case IdMethod.Identity: idValue = 0; idParam = Transaction.Instance.NewParameter("NewId", idValue, ParameterDirection.Output); sql = Transaction.SqlHelper(). BuildInsertSqlWithIdentity(tableName, fieldNames, parameterNames, "NewId"); break; case IdMethod.BySql: idSql = strategy.GetIdSqlFor(type); idValue = Transaction.Instance.ExecuteScalar(idSql); break; case IdMethod.Custom: idValue = strategy.GetIdFor(entity, Transaction.Instance); break; case IdMethod.UserSubmitted: idValue = strategy.GetIdFor(entity, Transaction.Instance); ((ActiveRecord.ActiveRecordBase)entity).Id = (long)idValue; fieldValues = strategy.GetFieldValuesOf(entity, fieldNames); break; } if (Transaction.SqlHelper().GetType() == typeof(MySqlHelper)) { //MySql için output parametreler ile ilgili sorun var!!! idParam.Value = Transaction.Instance.ExecuteScalar(sql, fieldValues); i = 1; //*** } else { i = Transaction.Instance.ExecuteNonQuery(sql, fieldValues, idParam); } if (idParam != null) { idValue = idParam.Value; //this works when 'idMethod' is '..Identity' } return(idValue); }
/// <summary> /// Adds a listener for parameters with the specified handle. /// </summary> /// <param name="handle">the parameter handle of interest /// </param> /// <param name="icd">the interaction class descriptor to notify /// </param> protected internal virtual void AddParameterListener(IParameterHandle handle, InteractionClassDescriptor icd) { parameterHandleListenerMap[handle] = icd; }
/// <summary> /// Returns the descriptor for the parameter with the given handle. /// </summary> /// <param name="handle">the handle of the parameter /// </param> /// <returns> the parameter descriptor, or <code>null</code> if no such /// descriptor exists /// </returns> public virtual ParameterDescriptor GetParameterDescriptor(IParameterHandle handle) { return parameterHandleDescriptorMap[handle]; }
/// <summary> /// Constructor. /// </summary> /// <param name="pName">the name of the parameter /// </param> public ParameterDescriptor(System.Xml.XmlElement parameterElement, IParameterHandle pHandle) : base(parameterElement) { this.handle = pHandle; }
/// <summary> /// Constructor. /// </summary> /// <param name="pName">the name of the parameter /// </param> public ParameterDescriptor(HLAInteractionParameter param, IParameterHandle pHandle) : base(param) { this.handle = pHandle; }