Пример #1
0
 public virtual Net.Vpc.Upa.PersistenceUnit AddPersistenceUnit(string name) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (name == null)
     {
         name = "";
     }
     Net.Vpc.Upa.PersistenceUnit persistenceUnit = GetFactory().CreateObject <Net.Vpc.Upa.PersistenceUnit>(typeof(Net.Vpc.Upa.PersistenceUnit));
     //        persistenceUnit.setName(name);
     //        persistenceUnit.setPersistenceGroup(this);
     persistenceUnit.Init(name, this);
     lock (persistenceUnits) {
         if (persistenceUnits.ContainsKey(name))
         {
             throw new Net.Vpc.Upa.Exceptions.PersistenceUnitAlreadyExistsException(name);
         }
         listeners.FireOnCreatePersistenceUnit(new Net.Vpc.Upa.Callbacks.PersistenceUnitEvent(persistenceUnit, this, Net.Vpc.Upa.EventPhase.BEFORE));
         persistenceUnits[name] = persistenceUnit;
         Net.Vpc.Upa.PersistenceUnit oldPersistenceUnit = GetPersistenceUnitProvider().GetPersistenceUnit(this);
         if (oldPersistenceUnit == null)
         {
             SetPersistenceUnit(persistenceUnit.GetName());
         }
         listeners.FireOnCreatePersistenceUnit(new Net.Vpc.Upa.Callbacks.PersistenceUnitEvent(persistenceUnit, this, Net.Vpc.Upa.EventPhase.AFTER));
     }
     log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("Create PersistenceUnit {0}/{1}", null, new object[] { GetName(), persistenceUnit.GetName() }));
     return(persistenceUnit);
 }