/// <summary> /// 填充元数据类型的信息 /// </summary> /// <param name="metadataType"></param> private void FillMetadataType(RuntimeObjectType metadataType) { metadataType.AddInterface(this.DomainInterfaceType); metadataType.AddAttribute(new ObjectRepositoryAttribute(typeof(IDynamicRepository)) { CloseMultiTenancy = this.CloseMultiTenancy }); }
private static RuntimeObjectType GetMetadataType(string typeName) { RuntimeObjectType metadataType = null; if (_metadataTypes.TryGetValue(typeName, out metadataType)) { return(metadataType); } return(null); }
/// <summary> /// 构建的类型 /// </summary> /// <param name="name"></param> /// <param name="ns"></param> /// <param name="relatedType"></param> /// <param name="metadataCode"></param> private void InitMetadataType() { var metadataType = GetMetadataType(this.TypeName); if (metadataType != null) { this.MetadataType = metadataType; } else { metadataType = new RuntimeObjectType(this.TypeName, this); //先加入索引 AddMetadataType(this.TypeName, metadataType); //为了防止由于类型嵌套导致的死循环,我们先把类型加入索引 //先赋值 this.MetadataType = metadataType; FillMetadataType(metadataType); RegisterProperies(metadataType); } }
private void AddMetadataType(string typeName, RuntimeObjectType metadataType) { _metadataTypes.TryAdd(typeName, metadataType); }