Beispiel #1
0
        public DuplicatedField(EnumStorage enumStorage, MemberInfo[] memberPath) : base(memberPath)
        {
            _enumStorage = enumStorage;
            _dbType      = TypeMappings.ToDbType(MemberType);



            ColumnName = MemberName.ToTableAlias();

            if (MemberType.IsEnum)
            {
                typeof(EnumRegistrar <>).CloseAndBuildAs <IEnumRegistrar>(MemberType).Register();



                _parseObject = expression =>
                {
                    var raw = expression.Value();
                    return(Enum.GetName(MemberType, raw));
                };

                _dbType = NpgsqlDbType.Varchar;
                PgType  = "varchar";
            }
        }
Beispiel #2
0
        public void execute_get_pg_type_custom_mappings_resolve_or_default_to_jsonb()
        {
            NpgsqlConnection.GlobalTypeMapper.MapComposite <MappedTarget>("varchar");

            TypeMappings.GetPgType(typeof(MappedTarget), EnumStorage.AsString).ShouldBe("varchar");
            TypeMappings.GetPgType(typeof(UnmappedTarget), EnumStorage.AsString).ShouldBe("jsonb");
        }
Beispiel #3
0
        private void generateBasicSetter(GeneratedMethod method)
        {
            method.Frames.Code($@"
parameters[{ParameterIndex}].NpgsqlDbType = {{0}};
parameters[{ParameterIndex}].Value = _query.{Member.Name};
", TypeMappings.ToDbType(Member.GetMemberType()));
        }
 public CommandParameter(object value)
 {
     Value = value;
     if (value != null)
     {
         DbType = TypeMappings.TryGetDbType(value.GetType());
     }
 }
        /// <summary>
        /// 得到任务执行器
        /// </summary>
        /// <param name="taskType"></param>
        /// <returns></returns>
        public ISysTaskExecutor GetExecutor(string taskType)
        {
            taskType.CheckStringIsNullOrEmpty("taskType");

            TypeMappings.ContainsKey(taskType).FalseThrow("不能在配置信息sysTaskSettings/typeMappings中找到任务类型为{0}的实现类", taskType);

            return(TypeMappings[taskType].CreateInstance <ISysTaskExecutor>());
        }
Beispiel #6
0
        public UpsertFunction(DocumentMapping mapping, DbObjectName identifier = null, bool disableConcurrency = false) : base(identifier ?? mapping.UpsertFunction)
        {
            _disableConcurrency = disableConcurrency;
            if (mapping == null)
            {
                throw new ArgumentNullException(nameof(mapping));
            }

            _tableName = mapping.Table;


            var table = new DocumentTable(mapping);

            if (table.PrimaryKeys.Count > 1)
            {
                _primaryKeyConstraintName = mapping.Table.Name + "_pkey";
            }
            else
            {
                _primaryKeyConstraintName = "pk_" + mapping.Table.Name;
            }



            var idType   = mapping.IdMember.GetMemberType();
            var pgIdType = TypeMappings.GetPgType(idType);

            Arguments.Add(new UpsertArgument
            {
                Arg          = "docId",
                PostgresType = pgIdType,
                Column       = "id",
                Members      = new[] { mapping.IdMember }
            });

            Arguments.Add(new DocJsonBodyArgument());

            Arguments.AddRange(mapping.DuplicatedFields.Select(x => x.UpsertArgument));

            Arguments.Add(new VersionArgument());

            Arguments.Add(new DotNetTypeArgument());

            if (mapping.IsHierarchy())
            {
                Arguments.Add(new DocTypeArgument());
            }

            if (mapping.UseOptimisticConcurrency)
            {
                Arguments.Add(new CurrentVersionArgument());
            }

            if (mapping.TenancyStyle == TenancyStyle.Conjoined)
            {
                Arguments.Add(new TenantIdArgument());
            }
        }
Beispiel #7
0
        protected Field(MemberInfo[] members)
        {
            Members    = members;
            MemberName = members.Select(x => x.Name).Join("");

            MemberType = members.Last().GetMemberType();

            PgType = TypeMappings.GetPgType(MemberType);
        }
 public ViewModelFactoryService()
 {
     TypeMappings.Add(typeof(LMTimelineEvent), typeof(LMTimelineEventVM));
     TypeMappings.Add(typeof(ScoreButton), typeof(ScoreButtonVM));
     TypeMappings.Add(typeof(PenaltyCardButton), typeof(PenaltyCardButtonVM));
     TypeMappings.Add(typeof(LMPlayer), typeof(LMPlayerVM));
     TypeMappings.Add(typeof(LMTeam), typeof(LMTeamVM));
     TypeMappings.Add(typeof(LMProject), typeof(LMProjectVM));
 }
Beispiel #9
0
        protected Field(EnumStorage enumStorage, MemberInfo[] members)
        {
            Members    = members;
            MemberName = members.Select(x => x.Name).Join("");

            FieldType = members.Last().GetMemberType();

            PgType = TypeMappings.GetPgType(FieldType, enumStorage);
        }
Beispiel #10
0
        private void generateMaskedStringCode(GeneratedMethod method)
        {
            var maskedValue = Mask.ToFormat($"_query.{Member.Name}");

            method.Frames.Code($@"
parameters[{ParameterIndex}].NpgsqlDbType = {{0}};
parameters[{ParameterIndex}].Value = {maskedValue};
", TypeMappings.ToDbType(Member.GetMemberType()));
        }
Beispiel #11
0
        public StreamTableColumn(string name, Expression <Func <StreamAction, object> > memberExpression) : base(name, "varchar")
        {
            _memberExpression = memberExpression;
            _member           = FindMembers.Determine(memberExpression).Single();
            var memberType = _member.GetMemberType();

            Type         = TypeMappings.GetPgType(memberType, EnumStorage.AsInteger);
            NpgsqlDbType = TypeMappings.ToDbType(memberType);
        }
Beispiel #12
0
        public DictionaryField(string dataLocator, Casing casing, EnumStorage enumStorage, MemberInfo[] members) : base(dataLocator, "JSONB", casing, members)
        {
            TypedLocator         = $"CAST({RawLocator} as {PgType})";
            _intermediateLocator = RawLocator.Replace("->>", "->");
            var valueType = FieldType.GenericTypeArguments[1];

            _isStringValue = valueType == typeof(string);
            _valuePgType   = TypeMappings.GetPgType(valueType, enumStorage);
        }
Beispiel #13
0
        public TypeMapping GetTypeMapping(string columnType)
        {
            var tm = TypeMappings.FirstOrDefault(t => t.DataType.Equals(columnType, StringComparison.OrdinalIgnoreCase));

            if (tm == null)
            {
                throw new Exception("类型没有对应的转换" + columnType);
            }
            return(tm);
        }
        /// <summary>
        /// Describes the schema of the underlying data and services to the K2 platform.
        /// </summary>
        public void DescribeSchema()
        {
            TypeMappings map = GetTypeMappings();

            //BlobContainer container = new BlobContainer(serviceBroker);
            //container.Create();

            //BlobBlob blob = new BlobBlob(serviceBroker);
            //blob.Create();
        }
Beispiel #15
0
 public virtual UpsertArgument ToArgument()
 {
     return(new UpsertArgument
     {
         Arg = "arg_" + Name,
         Column = Name,
         DbType = TypeMappings.ToDbType(DotNetType),
         PostgresType = Type,
         Members = new MemberInfo[] { Member }
     });
 }
        /// <summary>
        /// Sets the type mappings used to map the underlying data's types to the appropriate K2 SmartObject types.
        /// </summary>
        public void SetTypeMappings()
        {
            // Variable declaration.
            TypeMappings map = new TypeMappings();

            // Add type mappings.


            // Add the type mappings to the service instance.
            serviceBroker.Service.ServiceConfiguration.Add(__TypeMappings, map);
        }
Beispiel #17
0
        /// <summary>
        /// Sets the type mappings used to map the underlying data's types to the appropriate K2 SmartObject types.
        /// </summary>
        public string EdmToSystemType(string edmtype)
        {
            // Variable declaration.
            TypeMappings map     = new TypeMappings();
            string       nettype = "";

            switch (edmtype)
            {
            case "Edm.Binary":
            case "Edm.Byte":
            case "Edm.String":
                nettype = typeof(System.String).ToString();
                break;

            case "Edm.Boolean":
                nettype = typeof(System.Boolean).ToString();
                break;

            case "Edm.DateTime":
            case "Edm.DateTimeOffset":
            case "Edm.Time":
                nettype = typeof(System.DateTime).ToString();
                break;

            case "Edm.Double":
            case "Edm.Decimal":
            case "Edm.Single":
                nettype = typeof(System.Decimal).ToString();
                break;

            case "Edm.Guid":
                nettype = typeof(System.Guid).ToString();
                break;

            case "Edm.Int16":
                nettype = typeof(System.Int16).ToString();
                break;

            case "Edm.Int32":
                nettype = typeof(System.Int32).ToString();
                break;

            case "Edm.Int64":
                nettype = typeof(System.Int64).ToString();
                break;

            default:
                nettype = typeof(System.String).ToString();
                break;
            }

            // Add the type mappings to the service instance.
            return(nettype);
        }
Beispiel #18
0
        public DuplicatedField(EnumStorage enumStorage, IField innerField,
                               bool useTimestampWithoutTimeZoneForDateTime = true, bool notNull = false)
        {
            InnerField = innerField;
            MemberName = InnerField.Members.Select(x => x.Name).Join("");
            NotNull    = notNull;
            ColumnName = MemberName.ToTableAlias();
            this.useTimestampWithoutTimeZoneForDateTime = useTimestampWithoutTimeZoneForDateTime;

            PgType = TypeMappings.GetPgType(FieldType, enumStorage);

            if (FieldType.IsEnum)
            {
                if (enumStorage == EnumStorage.AsString)
                {
                    DbType = NpgsqlDbType.Varchar;
                    PgType = "varchar";

                    _parseObject = expression =>
                    {
                        var raw = expression.Value();
                        if (raw == null)
                        {
                            return(null);
                        }
                        return(Enum.GetName(FieldType, raw));
                    };
                }
                else
                {
                    DbType = NpgsqlDbType.Integer;
                    PgType = "integer";
                }
            }
            else if (FieldType.IsDateTime())
            {
                PgType = this.useTimestampWithoutTimeZoneForDateTime
                    ? "timestamp without time zone"
                    : "timestamp with time zone";
                DbType = this.useTimestampWithoutTimeZoneForDateTime
                    ? NpgsqlDbType.Timestamp
                    : NpgsqlDbType.TimestampTz;
            }
            else if (FieldType == typeof(DateTimeOffset) || FieldType == typeof(DateTimeOffset?))
            {
                PgType = "timestamp with time zone";
                DbType = NpgsqlDbType.TimestampTz;
            }
            else
            {
                DbType = TypeMappings.ToDbType(FieldType);
            }
        }
Beispiel #19
0
        protected IField resolveField(MemberInfo[] members)
        {
            foreach (var source in _options.FieldSources)
            {
                if (source.TryResolve(_dataLocator, _options, _serializer, _documentType, members, out var field))
                {
                    return(field);
                }
            }

            var fieldType = members.Last().GetMemberType();

            if (fieldType == typeof(string))
            {
                return(new StringField(_dataLocator, _serializer.Casing, members));
            }



            if (fieldType.IsEnum)
            {
                return(_serializer.EnumStorage == EnumStorage.AsInteger
                    ? (IField) new EnumAsIntegerField(_dataLocator, _serializer.Casing, members)
                    : new EnumAsStringField(_dataLocator, _serializer.Casing, members));
            }

            if (fieldType == typeof(DateTime) || fieldType == typeof(DateTime?))
            {
                return(new DateTimeField(_dataLocator, _options.DatabaseSchemaName, _serializer.Casing, members));
            }

            if (fieldType == typeof(DateTimeOffset) || fieldType == typeof(DateTimeOffset?))
            {
                return(new DateTimeOffsetField(_dataLocator, _options.DatabaseSchemaName, _serializer.Casing, members));
            }



            var pgType = TypeMappings.GetPgType(fieldType, _serializer.EnumStorage);


            if (pgType.IsNotEmpty())
            {
                if (fieldType.IsArray || fieldType.Closes(typeof(IList <>)))
                {
                    return(new ArrayField(_dataLocator, pgType, _serializer.Casing, members));
                }

                return(new SimpleCastField(_dataLocator, pgType, _serializer.Casing, members));
            }

            throw new NotSupportedException($"Marten does not support Linq expressions for this member. Was {_documentType.FullName}.{members.Select(x => x.Name).Join(".")}");
        }
Beispiel #20
0
        private void applyAnyMartenAttributes(Type documentType)
        {
            documentType.ForAttribute <MartenAttribute>(att => att.Modify(this));

            documentType.GetProperties()
            .Where(x => TypeMappings.HasTypeMapping(x.PropertyType))
            .Each(prop => { prop.ForAttribute <MartenAttribute>(att => att.Modify(this, prop)); });

            documentType.GetFields()
            .Where(x => TypeMappings.HasTypeMapping(x.FieldType))
            .Each(fieldInfo => { fieldInfo.ForAttribute <MartenAttribute>(att => att.Modify(this, fieldInfo)); });
        }
Beispiel #21
0
        protected Field(EnumStorage enumStorage, MemberInfo[] members, bool notNull = false)
        {
            Members    = members;
            MemberName = members.Select(x => x.Name).Join("");

            MemberType = members.Last().GetMemberType();

            PgType       = TypeMappings.GetPgType(MemberType, enumStorage);
            _enumStorage = enumStorage;

            NotNull = notNull;
        }
Beispiel #22
0
        public void add_type_by_dotnet_type_and_name()
        {
            var table = new Table("mytable");

            table.AddColumn <int>("number");
            var column = table.Columns.Single();

            column
            .Type.ShouldBe(TypeMappings.GetPgType(typeof(int), EnumStorage.AsInteger));

            table.Columns.ShouldContain(column);
        }
Beispiel #23
0
        public DocumentTable(DocumentMapping mapping) : base(mapping.Table)
        {
            // validate to ensure document has an Identity field or property
            mapping.Validate();

            var pgIdType   = TypeMappings.GetPgType(mapping.IdMember.GetMemberType());
            var pgTextType = TypeMappings.GetPgType(string.Empty.GetType());

            var idColumn = new TableColumn("id", pgIdType);

            if (mapping.TenancyStyle == TenancyStyle.Conjoined)
            {
                AddPrimaryKeys(new List <TableColumn>
                {
                    idColumn,
                    new TenantIdColumn()
                });

                Indexes.Add(new IndexDefinition(mapping, TenantIdColumn.Name));
            }
            else
            {
                AddPrimaryKey(idColumn);
            }

            AddColumn("data", "jsonb", "NOT NULL");

            AddColumn <LastModifiedColumn>();
            AddColumn <VersionColumn>();
            AddColumn <DotNetTypeColumn>();

            foreach (var field in mapping.DuplicatedFields)
            {
                AddColumn(new DuplicatedFieldColumn(field));
            }

            if (mapping.IsHierarchy())
            {
                AddColumn(new DocumentTypeColumn(mapping));
            }

            if (mapping.DeleteStyle == DeleteStyle.SoftDelete)
            {
                AddColumn <DeletedColumn>();
                Indexes.Add(new IndexDefinition(mapping, DocumentMapping.DeletedColumn));
                AddColumn <DeletedAtColumn>();
            }


            Indexes.AddRange(mapping.Indexes);
            ForeignKeys.AddRange(mapping.ForeignKeys);
        }
Beispiel #24
0
        public void execute_to_db_custom_mappings_resolve()
        {
            NpgsqlConnection.GlobalTypeMapper.AddMapping(new NpgsqlTypeMappingBuilder
            {
                PgTypeName         = "varchar",
                NpgsqlDbType       = NpgsqlDbType.Varchar,
                ClrTypes           = new[] { typeof(MappedTarget) },
                TypeHandlerFactory = new TextHandlerFactory()
            }.Build());

            TypeMappings.ToDbType(typeof(MappedTarget)).ShouldBe(NpgsqlDbType.Varchar);
            ShouldThrowExtensions.ShouldThrow <Exception>(() => TypeMappings.ToDbType(typeof(UnmappedTarget)));
        }
Beispiel #25
0
        private IField createFieldByFieldType(MemberInfo[] members, Type fieldType)
        {
            if (fieldType == typeof(string))
            {
                return(new StringField(_dataLocator, _serializer.Casing, members));
            }

            if (fieldType.Closes(typeof(IDictionary <,>)))
            {
                return(new DictionaryField(_dataLocator, _serializer.Casing, _serializer.EnumStorage, members));
            }

            if (fieldType.IsEnum)
            {
                return(_serializer.EnumStorage == EnumStorage.AsInteger
                    ? (IField) new EnumAsIntegerField(_dataLocator, _serializer.Casing, members)
                    : new EnumAsStringField(_dataLocator, _serializer.Casing, members));
            }

            if (fieldType == typeof(DateTime))
            {
                return(new DateTimeField(_dataLocator, _options.DatabaseSchemaName, _serializer.Casing, members));
            }

            if (fieldType == typeof(DateTimeOffset))
            {
                return(new DateTimeOffsetField(_dataLocator, _options.DatabaseSchemaName, _serializer.Casing, members));
            }


            var pgType = TypeMappings.GetPgType(fieldType, _serializer.EnumStorage);


            if (fieldType.Closes(typeof(IDictionary <,>)))
            {
                return(new SimpleCastField(_dataLocator, "JSONB", _serializer.Casing, members));
            }

            if (isEnumerable(fieldType))
            {
                return(new ArrayField(_dataLocator, pgType, _serializer, members));
            }

            if (pgType.IsNotEmpty())
            {
                return(new SimpleCastField(_dataLocator, pgType, _serializer.Casing, members));
            }

            throw new NotSupportedException(
                      $"Marten does not support Linq expressions for this member. Was {_documentType.FullName}.{members.Select(x => x.Name).Join(".")}");
        }
        /// <summary>
        /// Describes the schema of the underlying data and services to the K2 platform.
        /// </summary>
        public void DescribeSchema()
        {
            TypeMappings map = GetTypeMappings();

            SPSearch search = new SPSearch(serviceBroker, Configuration);

            search.Create();
            SPSearchUser usersearch = new SPSearchUser(serviceBroker, Configuration);

            usersearch.Create();
            SPSearchDocument documentsearch = new SPSearchDocument(serviceBroker, Configuration);

            documentsearch.Create();
        }
Beispiel #27
0
        public GeneratedType Build(GeneratedAssembly assembly)
        {
            var baseType = typeof(DeleteOne <,>).MakeGenericType(_mapping.DocumentType, _mapping.IdType);
            var type     = assembly.AddType($"Delete{_mapping.DocumentType.Name.Sanitize()}ById", baseType);

            var sql = $"delete from {_mapping.Table.QualifiedName} as d where id = ?";

            if (_mapping.DeleteStyle == DeleteStyle.SoftDelete)
            {
                sql =
                    $"update {_mapping.Table.QualifiedName} as d set {DocumentMapping.DeletedColumn} = True, {DocumentMapping.DeletedAtColumn} = now() where id = ?";
            }

            if (_mapping.TenancyStyle == TenancyStyle.Conjoined)
            {
                sql += $" and d.{TenantIdColumn.Name} = ?";
            }


            var commandText = Setter.Constant("CommandText", Constant.For(sql));

            type.Setters.Add(commandText);

            var configure = type.MethodFor(nameof(IQueryHandler.ConfigureCommand));

            configure.Frames.Call <CommandBuilder>(x => x.AppendWithParameters(null), call =>
            {
                call.Arguments[0] = commandText;
            });

            // Add the Id parameter
            configure.Frames.Code(@"
// Id parameter
{0}[0].NpgsqlDbType = {1};
{0}[0].Value = {2};

", Use.Type <NpgsqlParameter[]>(), TypeMappings.ToDbType(_mapping.IdType), type.AllInjectedFields[0]);

            if (_mapping.TenancyStyle == TenancyStyle.Conjoined)
            {
                configure.Frames.Code($@"
// tenant
{{0}}[1].NpgsqlDbType = {{1}};
{{0}}[1].Value = {{2}}.{nameof(IMartenSession.Tenant)}.{nameof(ITenant.TenantId)};
", Use.Type <NpgsqlParameter[]>(), NpgsqlDbType.Varchar, Use.Type <IMartenSession>());
            }


            return(type);
        }
 /// <summary>
 /// Factory method to get registered instance of type
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="constructorParameters"></param>
 /// <returns></returns>
 public T GetInstance <T>(params object[] constructorParameters)
 {
     if (TypeMappings.ContainsKey(typeof(T)))
     {
         var constructorTypes = constructorParameters.Select(x => x.GetType()).ToArray();
         var instance         = TypeMappings[typeof(T)].FirstOrDefault(x => x.ContainsConstructor(constructorTypes));
         if (instance == null)
         {
             throw new KeyNotFoundException($"Type {typeof(T).Name} has not been registered!");
         }
         return((T)IOCInstanceFactory.CreateInstance(instance.TargetType, constructorParameters));
     }
     throw new KeyNotFoundException($"Type {typeof(T).Name} has not been registered!");
 }
Beispiel #29
0
        protected override EditorGroup CreateEditorGroup(string groupName)
        {
            if (groupName != null)
            {
                var layout = this.renderer.GetGroupLayoutDefinition(groupName);
                var group  = new EditorGroup(this.Context, groupName, Resource.Layout.Custom_Group_Layout);
                group.LayoutManager = TypeMappings.CreateInstance(layout, this.Context) as DataFormLayoutManager;
                group.RootLayout().Background = new ColorDrawable(Color.White);

                return(group);
            }

            return(base.CreateEditorGroup(groupName));
        }
Beispiel #30
0
        public TableDefinition StorageTable()
        {
            var pgIdType = TypeMappings.GetPgType(_mapping.IdMember.GetMemberType());
            var table    = new TableDefinition(_mapping.Table, new TableColumn("id", pgIdType));


            table.Columns.Add(new TableColumn("data", "jsonb")
            {
                Directive = "NOT NULL"
            });

            table.Columns.Add(new TableColumn(DocumentMapping.LastModifiedColumn, "timestamp with time zone")
            {
                Directive = "DEFAULT transaction_timestamp()"
            });

            table.Columns.Add(new TableColumn(DocumentMapping.VersionColumn, "uuid")
            {
                Directive = "NOT NULL default(md5(random()::text || clock_timestamp()::text)::uuid)"
            });

            table.Columns.Add(new TableColumn(DocumentMapping.DotNetTypeColumn, "varchar"));

            _mapping.DuplicatedFields.Select(x => x.ToColumn()).Each(x => table.Columns.Add(x));


            if (_mapping.IsHierarchy())
            {
                table.Columns.Add(new TableColumn(DocumentMapping.DocumentTypeColumn, "varchar")
                {
                    Directive = $"DEFAULT '{_mapping.AliasFor(_mapping.DocumentType)}'"
                });
            }

            if (_mapping.DeleteStyle == DeleteStyle.SoftDelete)
            {
                table.Columns.Add(new TableColumn(DocumentMapping.DeletedColumn, "boolean")
                {
                    Directive = "DEFAULT FALSE"
                });

                table.Columns.Add(new TableColumn(DocumentMapping.DeletedAtColumn, "timestamp with time zone")
                {
                    Directive = "NULL"
                });
            }

            return(table);
        }
        //strong to weak
        public static BinaryFormatter BuildWriter()
        {

            var newWriter = new BinaryFormatter();
            var ss = new LegacySurrogateSelector();

            var maps = new TypeMappings();

            foreach (TypeMap map in maps)
            {
                ss.AddSurrogate(new StrongToWeakItemSurrogate(map));
            }
            newWriter.SurrogateSelector = ss;

            return newWriter;
        }
        //weak to strong
        public static BinaryFormatter BuildReader()
        {
            var newReader = new BinaryFormatter();

            var readerSelector = new LegacySurrogateSelector();
            readerSelector.AddSurrogate(new WeakToStrongListSurrogate<List<Subscription>, Subscription>("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "System.Collections.Generic.List`1[[MassTransit.ServiceBus.Subscriptions.Subscription, MassTransit.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]"));


            newReader.SurrogateSelector = readerSelector;


            //smelly
            var b = new WeakToStrongBinder();
            var maps = new TypeMappings();

            foreach (TypeMap map in maps)
            {
                b.AddMap(map);
            }

            newReader.Binder = b;
            return newReader;
        }
Beispiel #33
0
        private static TypeMappings CreateTypeMappings()
        {
            TypeMappings map = new TypeMappings();
            map.Add(typeof(System.Int16), SoType.Number);
            map.Add(typeof(System.Int32), SoType.Number);
            map.Add(typeof(System.Int64), SoType.Number);
            map.Add(typeof(System.UInt16), SoType.Number);
            map.Add(typeof(System.UInt32), SoType.Number);
            map.Add(typeof(System.UInt64), SoType.Number);
            map.Add(typeof(System.Boolean), SoType.YesNo);
            map.Add(typeof(System.Char), SoType.Text);
            map.Add(typeof(System.DateTime), SoType.DateTime);
            map.Add(typeof(System.Decimal), SoType.Decimal);
            map.Add(typeof(System.Single), SoType.Decimal);
            map.Add(typeof(System.Double), SoType.Decimal);
            map.Add(typeof(System.Guid), SoType.Guid);
            map.Add(typeof(System.Byte), SoType.File);
            map.Add(typeof(System.SByte), SoType.File);
            map.Add(typeof(System.String), SoType.Text);

            map.Add(typeof(Nullable<System.Int16>), SoType.Number);
            map.Add(typeof(Nullable<System.Int32>), SoType.Number);
            map.Add(typeof(Nullable<System.Int64>), SoType.Number);
            map.Add(typeof(Nullable<System.UInt16>), SoType.Number);
            map.Add(typeof(Nullable<System.UInt32>), SoType.Number);
            map.Add(typeof(Nullable<System.UInt64>), SoType.Number);
            map.Add(typeof(Nullable<System.Boolean>), SoType.YesNo);
            map.Add(typeof(Nullable<System.Char>), SoType.Text);
            map.Add(typeof(Nullable<System.DateTime>), SoType.DateTime);
            map.Add(typeof(Nullable<System.Decimal>), SoType.Decimal);
            map.Add(typeof(Nullable<System.Single>), SoType.Decimal);
            map.Add(typeof(Nullable<System.Double>), SoType.Decimal);
            map.Add(typeof(Nullable<System.Guid>), SoType.Guid);
            map.Add(typeof(Nullable<System.Byte>), SoType.File);
            map.Add(typeof(Nullable<System.SByte>), SoType.File);

            return map;
        }
        /// <summary>
        /// Sets the type mappings used to map the underlying data's types to the appropriate K2 SmartObject types.
        /// </summary>
        public void SetTypeMappings()
        {
            // Variable declaration.
            TypeMappings map = new TypeMappings();

            // Add type mappings.


            // Add the type mappings to the service instance.
            serviceBroker.Service.ServiceConfiguration.Add(__TypeMappings, map);
        }