public virtual void RegisterEntity(Net.Vpc.Upa.Entity item, Net.Vpc.Upa.Package parent) { Net.Vpc.Upa.NamingStrategy namingStrategy = unit.GetNamingStrategy(); string s = item.GetName(); s = namingStrategy.GetUniformValue(s); Net.Vpc.Upa.Entity entity = (Net.Vpc.Upa.Entity)item; entities[s] = item; System.Type entityType = entity.GetEntityType(); if (!entityManagerByEntityTypeAmbiguity.Contains(entityType)) { if (entityManagerByEntityType.ContainsKey(entityType)) { entityManagerByEntityType.Remove(entityType); entityManagerByEntityTypeAmbiguity.Add(entityType); } else { entityManagerByEntityType[entityType] = entity; } } System.Type idType = Net.Vpc.Upa.Impl.Util.PlatformUtils.ToRefType(entity.GetIdType()); if (!entityManagerByIdTypeAmbiguity.Contains(idType)) { if (entityManagerByIdType.ContainsKey(idType)) { entityManagerByIdType.Remove(idType); entityManagerByIdTypeAmbiguity.Add(idType); } else { entityManagerByIdType[idType] = entity; } } }
protected internal virtual bool IsDetailOrMasterEntity(Net.Vpc.Upa.Entity e) { string n = e.GetName(); System.Type t = e.GetEntityType(); if (n.Equals(relationDescriptor.GetSourceEntity()) || t.Equals(relationDescriptor.GetSourceEntityType())) { return(true); } if (n.Equals(relationDescriptor.GetTargetEntity()) || t.Equals(relationDescriptor.GetTargetEntityType())) { return(true); } return(false); }
private void BindRelation(Net.Vpc.Upa.Entity masterEntity) { Net.Vpc.Upa.Types.DataType dataType = field.GetDataType(); if (dataType is Net.Vpc.Upa.Impl.SerializableOrManyToOneType) { field.SetDataType(new Net.Vpc.Upa.Types.ManyToOneType(dataType.GetName(), dataType.GetPlatformType(), masterEntity.GetName(), true, dataType.IsNullable())); field.SetTypeTransform(null); field.SetTypeTransform(new Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform(field.GetDataType())); Net.Vpc.Upa.DefaultRelationshipDescriptor relationDescriptor = new Net.Vpc.Upa.DefaultRelationshipDescriptor(); relationDescriptor.SetBaseField(field.GetName()); relationDescriptor.SetTargetEntityType(masterEntity.GetEntityType()); relationDescriptor.SetTargetEntity(masterEntity.GetName()); relationDescriptor.SetSourceEntityType(field.GetEntity().GetEntityType()); relationDescriptor.SetSourceEntity(field.GetEntity().GetName()); field.GetPersistenceUnit().AddRelationship(relationDescriptor); } }
public TypeInfo(string binding, Net.Vpc.Upa.Entity entity) { this.binding = binding; int dotPos = binding == null ? -1 : binding.LastIndexOf('.'); if (dotPos > 0) { this.parentBinding = binding.Substring(0, dotPos); this.bindingName = binding.Substring(dotPos + 1); } this.entity = entity; if (entity != null) { entityFactory = entity.GetBuilder(); entityConverter = entity.GetBuilder(); entityType = entity.GetEntityType(); } }
public virtual System.Type GetPlatformType() { return(entity.GetEntityType()); }
public EntityBeanType(Net.Vpc.Upa.Entity entity) { this.platformBeanType = Net.Vpc.Upa.Impl.Util.PlatformBeanTypeRepository.GetInstance().GetBeanType(entity.GetEntityType()); this.entity = entity; try { //entity.GetEntityType().GetConstructor().SetAccessible(true); } catch (System.Exception e) { throw new System.ArgumentException("Unable to resolve default constructor for type " + entity.GetEntityType() + " (entity " + entity.GetName() + ")", e); } foreach (Net.Vpc.Upa.Field field in entity.GetFields()) { GetAttrAdapter(field.GetName()); } }