private static EntityDefinition CreateDefinition(Field[] fields)
        {
            var concept = new Concept { Fields = fields };

             var def = new EntityDefinition {PersonId = "PersonId", StartDate = "StartDate", Concepts = new Concept[1]};
             def.Concepts[0] = concept;
             return def;
        }
Beispiel #2
0
        public List<LookupValue> GetValues(Vocabulary vocabulary, Field field, IDataReader reader)
        {
            if (!string.IsNullOrEmpty(field.ConceptId))
             {
            var conceptId = reader.GetInt(field.ConceptId);
            return new List<LookupValue> { new LookupValue { ConceptId = conceptId } };
             }

             var mapper = FindMapper(ConceptIdMappers, reader);

             if (mapper == null)
            return new List<LookupValue> { new LookupValue { ConceptId = field.DefaultConceptId } };

             var conceptKey = reader.GetString(field.Key);

             if (conceptKey == null) return new List<LookupValue>();

             return mapper.Map(vocabulary, field.Key, conceptKey, reader.GetDateTime(field.EventDate));
        }
Beispiel #3
0
        public int? GetTypeId(Field field, IDataReader reader)
        {
            if (!string.IsNullOrEmpty(field.TypeId))
             {
            return reader.GetInt(field.TypeId);
             }

             var mapper = FindMapper(TypeIdMappers, reader);
             if (mapper == null)
             {
            return field.DefaultTypeId;
             }

             var typeIds = mapper.Map(null, field.Key, reader[field.Key].ToString(), reader.GetDateTime(field.EventDate));

             if (typeIds.Count == 0)
            return null;

             return (int?)typeIds[0].ConceptId;
        }