Пример #1
0
 public override void Persist(Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext, Net.Vpc.Upa.PersistenceState status) /* throws System.Exception, Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Entity entity = (Net.Vpc.Upa.Entity)@object;
     Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore persistenceUnitManager = (Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore)executionContext.GetPersistenceStore();
     log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("Commit {0} / {1} : found {2}, persist", null, new object[] { @object, typedObject, status }));
     Net.Vpc.Upa.Persistence.UConnection b = executionContext.GetConnection();
     b.ExecuteNonQuery(persistenceUnitManager.GetCreateTableStatement(entity, executionContext), null, null);
 }
 public virtual void AfterPersist(Net.Vpc.Upa.Record record, Net.Vpc.Upa.Persistence.EntityExecutionContext context)
 {
     if (new System.Nullable <bool>(false).Equals(context.GetConnection().GetProperty(identityConstraintsEnabledProperty)))
     {
         return;
     }
     record.SetObject(field.GetName(), context.GetGeneratedValue(field.GetName()).GetValue());
 }
 public virtual void BeforePersist(Net.Vpc.Upa.Record record, Net.Vpc.Upa.Persistence.EntityExecutionContext context) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (new System.Nullable <bool>(false).Equals(context.GetConnection().GetProperty(identityConstraintsEnabledProperty)))
     {
         return;
     }
     context.AddGeneratedValue(field.GetName(), field.GetDataType());
     //manual id values are ignored
     record.Remove(field.GetName());
 }
Пример #4
0
 public override void Persist(Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext, Net.Vpc.Upa.PersistenceState status) /* throws System.Exception, Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Relationship relation = (Net.Vpc.Upa.Relationship)@object;
     Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore persistenceUnitManager = (Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore)executionContext.GetPersistenceStore();
     log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("Commit {0} / {1} : found {2}, persist", null, new object[] { @object, typedObject, status }));
     if (!relation.IsTransient() && persistenceUnitManager.IsReferencingSupported())
     {
         Net.Vpc.Upa.Persistence.UConnection b = executionContext.GetConnection();
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateRelationshipStatement(relation), null, null);
     }
 }
Пример #5
0
 public override void Persist(Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext, Net.Vpc.Upa.PersistenceState status) /* throws System.Exception, Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Index index = (Net.Vpc.Upa.Index)@object;
     Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore persistenceUnitManager = (Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore)executionContext.GetPersistenceStore();
     if (!persistenceUnitManager.IsView(index.GetEntity()))
     {
         log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("Commit {0} / {1} : found {2}, persist", null, new object[] { @object, typedObject, status }));
         Net.Vpc.Upa.Persistence.UConnection b = executionContext.GetConnection();
         if (status == Net.Vpc.Upa.PersistenceState.DIRTY)
         {
             b.ExecuteNonQuery(persistenceUnitManager.GetDropIndexStatement(index), null, null);
         }
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateIndexStatement(index), null, null);
     }
 }
Пример #6
0
 public CustomUpdateQueryExecutor(Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore defaultPersistenceStore, System.Collections.Generic.IDictionary <string, object> finalHints, Net.Vpc.Upa.Expressions.Update baseExpression, System.Collections.Generic.IDictionary <string, object> parametersByName, System.Collections.Generic.IDictionary <int?, object> parametersByIndex, bool updatable, Net.Vpc.Upa.Filters.FieldFilter defaultFieldFilter, Net.Vpc.Upa.Persistence.EntityExecutionContext context, System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.VarVal> complexVals, Net.Vpc.Upa.Entity entity, string entityName, Net.Vpc.Upa.Persistence.ResultMetaData metadata)
 {
     this.defaultPersistenceStore = defaultPersistenceStore;
     this.finalHints         = finalHints;
     this.baseExpression     = baseExpression;
     this.parametersByName   = parametersByName;
     this.parametersByIndex  = parametersByIndex;
     this.updatable          = updatable;
     this.defaultFieldFilter = defaultFieldFilter;
     this.context            = context;
     this.complexVals        = complexVals;
     this.entity             = entity;
     this.entityName         = entityName;
     this.metadata           = metadata;
     this.connection         = context.GetConnection();
 }
Пример #7
0
 public override void Persist(Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext, Net.Vpc.Upa.PersistenceState status) /* throws System.Exception, Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Entity entity = (Net.Vpc.Upa.Entity)@object;
     Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore store = (Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore)executionContext.GetPersistenceStore();
     if ((entity.GetPrimaryFields()).Count > 0)
     {
         log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("Commit {0} / {1} : found {2}, persist", null, new object[] { @object, typedObject, status }));
         Net.Vpc.Upa.Persistence.UConnection b = executionContext.GetConnection();
         foreach (Net.Vpc.Upa.PrimitiveField primaryField in entity.GetPrimitiveFields(Net.Vpc.Upa.Filters.Fields.Id()))
         {
             Net.Vpc.Upa.Impl.Persistence.ColumnDesc cd = store.LoadColumnDesc(primaryField, b.GetMetadataAccessibleConnection());
             if (cd.IsNullable() != null && (cd.IsNullable()).Value)
             {
                 b.ExecuteNonQuery(store.GetAlterTableAlterColumnNullStatement(primaryField, false), null, null);
             }
         }
         b.ExecuteNonQuery(store.GetCreateTablePKConstraintStatement(entity), null, null);
     }
 }
Пример #8
0
 public override void Persist(Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext, Net.Vpc.Upa.PersistenceState status) /* throws System.Exception, Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Entity entityManager = (Net.Vpc.Upa.Entity)@object;
     Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore persistenceUnitManager = (Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore)executionContext.GetPersistenceStore();
     log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("Commit {0} / {1} : found {2}, persist", null, new object[] { @object, typedObject, status }));
     Net.Vpc.Upa.Persistence.UConnection b = executionContext.GetConnection();
     System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ViewEntityExtension> specSupport = entityManager.GetExtensions <Net.Vpc.Upa.Persistence.ViewEntityExtension>(typeof(Net.Vpc.Upa.Persistence.ViewEntityExtension));
     foreach (Net.Vpc.Upa.Persistence.ViewEntityExtension ss in specSupport)
     {
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateViewStatement(entityManager, ss.GetQuery(), executionContext), null, null);
     }
     System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.UnionEntityExtension> uspecSupport = entityManager.GetExtensions <Net.Vpc.Upa.Persistence.UnionEntityExtension>(typeof(Net.Vpc.Upa.Persistence.UnionEntityExtension));
     foreach (Net.Vpc.Upa.Persistence.UnionEntityExtension ss in uspecSupport)
     {
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateViewStatement(entityManager, ss.GetQuery(), executionContext), null, null);
     }
     System.Collections.Generic.IList <Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition> fspecSupport = entityManager.GetExtensionDefinitions <Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition>(typeof(Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition));
     foreach (Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition ss in fspecSupport)
     {
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateViewStatement(entityManager, ss.GetQuery(), executionContext), null, null);
     }
 }
 private Net.Vpc.Upa.Persistence.UConnection GetConnection(Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext)
 {
     return(executionContext.GetConnection());
 }