public object ExcuteNonQuery(object persistenceObject)
{
ObjectId id = null;
try
{
scope.Add(persistenceObject);
id = scope.GetObjectId(persistenceObject);
}
catch (Exception e)
{
scope.Transaction.Rollback();
}
return id;
}
public object AddProperty(Property1 obj) Method-1
{
connection.StartTransaction();
object id = connection.ExcuteNonQuery(obj);
connection.EndTransaction();
connection.DisposeScopeObject();
return id;
}
public
void AddPropertyFeaturesMapping(Property1 property, ArrayList FeaturesList) Method-2
{
try
{
connection.StartTransaction();
for (int i = 0; i < FeaturesList.Count; i++)
{
ArrayList list = (ArrayList)FeaturesList[i];
for (int j = 0; j < list.Count; i++)
{
PropertyUnitsFeature feature = (PropertyUnitsFeature)list[j];
PropertyUnitsFeaturesList obj = new PropertyUnitsFeaturesList();
obj.PropertyRegistrationNumber = property.PropertyRegistrationNumber;
obj.PropertyUnitFeaturesId = feature.PropertyUnitFeaturesId;
object id = connection.ExcuteNonQuery(obj);
}
}
connection.EndTransaction();
connection.DisposeScopeObject();
}
catch (Exception e)
{
connection.RollBackTransaction();
connection.DisposeScopeObject();
}
}
First method is adding property object and second one is adding the features of property. There is m:n relation ship between Property and Features. Problem is that when i add property object, it is added successfully, but when adding features against property it raise error,"No active transaction", when loop is iterating for 2nd time to run "connection.ExcuteNonQuery(obj); " error raises.