Example #1
0
            void IFieldGenericExecutor.Execute <TField, TData>(IField field)
            {
                var storageSqlType    = SqlTypeHelper.GetDataType(field.FieldDataType);
                var entityDefinitions = _schemaBuilder.EntityDefinitions.Where(q => q.EntityType == field.FieldDataType)
                                        .ToArray();

                if (storageSqlType != null)
                {
                    EntityField = BuildValueField <TData>(field);
                }
                else if (entityDefinitions.Length == 0)
                {
                    EntityField = BuildEmbeddedField <TData>(field);
                }
                else
                {
                    EntityField = BuildReferencedField <TData>(field, entityDefinitions.First());
                }
            }
Example #2
0
            void IFieldGenericExecutor.Execute <TField, TData>(IField field)
            {
                var columnNamePrefix = string.Join("_", _relativeParentFields.Select(q => q.FieldName));

                if (!string.IsNullOrEmpty(columnNamePrefix))
                {
                    columnNamePrefix = $"{columnNamePrefix}_";
                }

                EntityField = new ValueEntityField <TData, TEntity>(field.FieldName, field.CanRead,
                                                                    field.CanWrite,
                                                                    //  value storage column
                                                                    new Column(
                                                                        $"{columnNamePrefix}{_modelField.FieldName}_{field.FieldName}", SqlTypeHelper.GetDataType(typeof(TData)),
                                                                        true),
                                                                    _source, false);
            }