示例#1
0
        /// <summary>
        /// Serialize to string
        /// </summary>
        /// <returns>Serialized as string</returns>
        public string Serialize()
        {
            IDataId dataId = EnsureDataIdType(_dataId);

            if ((_serializedData == null) || (dataId != _dataId))
            {
                string s = SerializationFacade.Serialize(this.DataId);

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                StringConversionServices.SerializeKeyValuePair(sb, "_dataId_", s);
                StringConversionServices.SerializeKeyValuePair(sb, "_dataIdType_", TypeManager.SerializeType(this.DataId.GetType()));

                if (_providerName != DataProviderRegistry.DefaultDynamicTypeDataProviderName)
                {
                    StringConversionServices.SerializeKeyValuePair(sb, "_providerName_", _providerName);
                }

                StringConversionServices.SerializeKeyValuePair(sb, "_interfaceType_", TypeManager.SerializeType(_interfaceType));
                StringConversionServices.SerializeKeyValuePair(sb, "_dataScope_", DataScopeIdentifier.Serialize());
                StringConversionServices.SerializeKeyValuePair(sb, "_localeScope_", LocaleScope.Name);

                _serializedData = sb.ToString();
            }

            return(_serializedData);
        }
示例#2
0
        /// <summary>
        /// Serializes this instance
        /// </summary>
        /// <returns>String representation</returns>
        public string Serialize()
        {
            string serializedSearchToken = SerializationFacade.Serialize(this);
            string serializedClassName   = TypeManager.SerializeType(this.GetType());

            string serializedSearchTokenWithClass = string.Format("{0}|{1}", serializedClassName, serializedSearchToken);

            return(serializedSearchTokenWithClass);
        }
示例#3
0
        public static string Serialize(this IDataId dataId)
        {
            if (dataId == null)
            {
                throw new ArgumentNullException("dataId");
            }

            StringBuilder sb = new StringBuilder();

            StringConversionServices.SerializeKeyValuePair(sb, "_dataIdType_", TypeManager.SerializeType(dataId.GetType()));
            StringConversionServices.SerializeKeyValuePair(sb, "_dataId_", SerializationFacade.Serialize(dataId));

            return(sb.ToString());
        }
        public static string Serialize(this IDataId dataId, IEnumerable <string> propertyNames)
        {
            if (dataId == null)
            {
                throw new ArgumentNullException(nameof(dataId));
            }

            var sb = new StringBuilder();

            SerializeKeyValuePair(sb, "_dataIdType_", TypeManager.SerializeType(dataId.GetType()));
            SerializeKeyValuePair(sb, "_dataId_", SerializationFacade.Serialize(dataId, propertyNames));

            return(sb.ToString());
        }