Zetbox.API.SerializableType.GetSystemType C# (CSharp) Method

GetSystemType() public method

Returns the serialized System.Type
public GetSystemType ( ) : Type
return System.Type
        public Type GetSystemType()
        {
            if (!this.AssemblyQualifiedName.StartsWith(TypeName))
            {
                throw new InvalidOperationException("FullName doesn't match AssemblyQualifiedName");
            }
            Type result = null;
            if (GenericTypeParameter.Length > 0)
            {
                Type type = Type.GetType(AssemblyQualifiedName);
                if (type != null) result = type.MakeGenericType(GenericTypeParameter.Select(t => t.GetSystemType()).ToArray());
            }
            else
            {
                result = Type.GetType(AssemblyQualifiedName);
            }

            if (result == null)
            {
                throw new InvalidOperationException(string.Format("Unable to create Type {0}{1}",
                    TypeName,
                    GenericTypeParameter.Length > 0 ? "<" + string.Join(", ", GenericTypeParameter.Select(t => t.TypeName).ToArray()) + ">" : String.Empty));
            }

            return result;
        }

Usage Example

示例#1
0
        public byte[] GetListOf(Guid version, SerializableType type, int ID, string property)
        {
            using (Logging.Facade.DebugTraceMethodCallFormat("GetListOf", "type={0}", type))
            {
                DebugLogIdentity();
                try
                {
                    if (type == null) { throw new ArgumentNullException("type"); }

                    using (var ctx = _ctxFactory())
                    {
                        var ifType = _iftFactory(type.GetSystemType());
                        int resultCount = 0;
                        var ticks = _perfCounter.IncrementGetListOf(ifType);
                        try
                        {
                            IEnumerable<IStreamable> lst = _sohFactory
                                .GetServerObjectHandler(ifType)
                                .GetListOf(version, ctx, ID, property);
                            resultCount = lst.Count();
                            return SendObjects(lst, false /*true*/).ToArray();
                        }
                        finally
                        {
                            _perfCounter.DecrementGetListOf(ifType, resultCount, ticks);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Helper.ThrowFaultException(ex);
                    // Never called, Handle errors throws an Exception
                    return null;
                }
            }
        }
All Usage Examples Of Zetbox.API.SerializableType::GetSystemType