Catel.Data.ModelBase.ModelBase C# (CSharp) Метод

ModelBase() защищенный Метод

Initializes a new instance of the ModelBase class. Only constructor for the ModelBase.
Call this method, even when constructing the object for the first time (thus not deserializing).
protected ModelBase ( SerializationInfo info, StreamingContext context ) : Catel.IoC
info SerializationInfo SerializationInfo object, null if this is the first time construction.
context StreamingContext StreamingContext object, simple pass a default new StreamingContext() if this is the first time construction.
Результат Catel.IoC
        protected ModelBase(SerializationInfo info, StreamingContext context)
        {
            OnInitializing();

            Initialize();

            // Make sure this is not a first time call or custom call with null
            if (info == null)
            {
                FinishInitializationAfterConstructionOrDeserialization();
            }
            else
            {
                _serializationInfo = info;

                // Too bad we cannot put this in the BinarySerializer, but BinarySerialization works bottom => top. We
                // do need the GraphId though, thus we are setting it here
                var scopeName = SerializationContextHelper.GetSerializationReferenceManagerScopeName();
                using (var scopeManager = ScopeManager<ReferenceManager>.GetScopeManager(scopeName))
                {
                    var referenceManager = scopeManager.ScopeObject;

                    int? graphId = null;

                    try
                    {
                        // Binary
                        graphId = (int)info.GetValue("GraphId", typeof (int));
                    }
                    catch (Exception)
                    {
                        // Swallow
                    }

                    if (graphId.HasValue)
                    {
                        referenceManager.RegisterManually(graphId.Value, this);
                    }
                }
            }

            OnInitialized();
        }

Same methods

ModelBase::ModelBase ( ) : System