private EvidenceTypeDescriptor(EvidenceTypeDescriptor descriptor)
 {
     this.m_hostCanGenerate = descriptor.m_hostCanGenerate;
     if (descriptor.m_assemblyEvidence != null)
     {
         this.m_assemblyEvidence = descriptor.m_assemblyEvidence.Clone();
     }
     if (descriptor.m_hostEvidence != null)
     {
         this.m_hostEvidence = descriptor.m_hostEvidence.Clone();
     }
 }
        /// <summary>
        ///     Make a deep copy of a type descriptor
        /// </summary>
        private EvidenceTypeDescriptor(EvidenceTypeDescriptor descriptor)
        {
            Contract.Assert(descriptor != null);

            m_hostCanGenerate = descriptor.m_hostCanGenerate;

            if (descriptor.m_assemblyEvidence != null)
            {
                m_assemblyEvidence = descriptor.m_assemblyEvidence.Clone() as EvidenceBase;
            }
            if (descriptor.m_hostEvidence != null)
            {
                m_hostEvidence = descriptor.m_hostEvidence.Clone() as EvidenceBase;
            }

#if _DEBUG
            m_evidenceType = descriptor.m_evidenceType;
#endif // _DEBUG
        }
        private static EvidenceBase HandleDuplicateEvidence(EvidenceBase original, EvidenceBase duplicate, DuplicateEvidenceAction action)
        {
            switch (action)
            {
            case DuplicateEvidenceAction.Throw:
                throw new InvalidOperationException(Environment.GetResourceString("Policy_DuplicateEvidence", new object[] { duplicate.GetType().FullName }));

            case DuplicateEvidenceAction.Merge:
            {
                LegacyEvidenceList list = original as LegacyEvidenceList;
                if (list == null)
                {
                    list = new LegacyEvidenceList();
                    list.Add(original);
                }
                list.Add(duplicate);
                return(list);
            }

            case DuplicateEvidenceAction.SelectNewObject:
                return(duplicate);
            }
            return(null);
        }
        /// <summary>
        ///     Verify that evidence being stored in this descriptor is of the correct type
        /// </summary>
        private bool CheckEvidenceType(EvidenceBase evidence)
        {
            Contract.Assert(evidence != null);

            ILegacyEvidenceAdapter legacyAdapter = evidence as ILegacyEvidenceAdapter;
            Type storedType = legacyAdapter == null ? evidence.GetType() : legacyAdapter.EvidenceType;

            return m_evidenceType == null || m_evidenceType.IsAssignableFrom(storedType);
        }
Пример #5
0
 public static void AddHostEvidence(this Evidence evidence, EvidenceBase e)
 {
     throw new NotImplementedException();
 }
Пример #6
0
		public static void AddHostEvidence (this Evidence evidence, EvidenceBase e)
		{
			throw new NotImplementedException ();
		}