Esempio n. 1
0
        public static object GetObjectByName(
            [NotNull] this SqlDataReader reader,
            [NotNull] string column,
            [CanBeNull] object nullValue = null,
            [CanBeNull] object context = null,
            StreamingContextStates contextState = StreamingContextStates.Other)
        {
            if (reader == null) throw new ArgumentNullException("reader");
            if (column == null) throw new ArgumentNullException("column");

            int ordinal = reader.GetOrdinal(column);
            if (reader.IsDBNull(ordinal))
                return nullValue;

            SqlBytes bytes = reader.GetSqlBytes(ordinal);
            using (Stream serializationStream = bytes.Stream)
            {
                Debug.Assert(serializationStream != null);
                return Serialize.GetFormatter(context, contextState).Deserialize(serializationStream);
            }
        }
Esempio n. 2
0
 internal StreamingContext(StreamingContextStates state, Object additional)
 {
     m_state = state;
     m_additionalContext = additional;
 }
Esempio n. 3
0
 internal StreamingContext(StreamingContextStates state)
     : this(state, null)
 {
 }
Esempio n. 4
0
		public StreamingContext (StreamingContextStates state)
		{
			this.state = state;
			additional = null;
		}
 /// <summary>
 /// Creates a StreamingContext with a CommandSerializationContext as its user context
 /// </summary>
 public static StreamingContext ToStreamingContext( StreamingContextStates state, CommandUserRegistry userRegistry, CommandRegistry commandRegistry )
 {
     CommandSerializationContext userContext = new CommandSerializationContext( userRegistry, commandRegistry );
     StreamingContext context = new StreamingContext( state, userContext );
     return context;
 }
 private NotProperImplementedSerializableClass(SerializationInfo info, StreamingContext context) // Noncompliant, because using the serialization info is required for properly implementing the serializable constructor.
 {
     state = context.State;
 }
Esempio n. 7
0
 //
 // Summary:
 //     Initializes a new instance of the System.Runtime.Serialization.StreamingContext
 //     class with a given context state.
 //
 // Parameters:
 //   state:
 //     A bitwise combination of the System.Runtime.Serialization.StreamingContextStates
 //     values that specify the source or destination context for this System.Runtime.Serialization.StreamingContext.
 public StreamingContext(StreamingContextStates state)
 {
     m_States = state;
 }
 public StreamingContext(StreamingContextStates state, object additional)
 {
 }
Esempio n. 9
0
 public StreamingContext(StreamingContextStates state) { throw new NotSupportedException(); }
Esempio n. 10
0
 public StreamingContext(StreamingContextStates state, object context)
 {
     State = state;
     Context = context;
 }
 // Constructors
 public StreamingContext(StreamingContextStates state)
 {
 }
Esempio n. 12
0
 public StreamingContext(StreamingContextStates state, object additional)
 {
     this.state      = state;
     this.additional = additional;
 }
Esempio n. 13
0
 public StreamingContext(StreamingContextStates state)
 {
     this.state = state;
     additional = null;
 }
Esempio n. 14
0
 public StreamingContext(StreamingContextStates state)
     : this(state, null)
 {
 }
 public StreamingContext(StreamingContextStates state)
   : this(state, null)
 {
 }
Esempio n. 16
0
 public StreamingContext(StreamingContextStates state, object additional) { throw new NotSupportedException(); }
 public StreamingContext(StreamingContextStates state, object additional)
 {
   this.m_state = state;
   this.m_additionalContext = additional;
 }
Esempio n. 18
0
 public StreamingContext(StreamingContextStates state, object?additional)
 {
     _state             = state;
     _additionalContext = additional;
 }