예제 #1
0
        public Type GetProxyType(Type classType)
        {
            if (classType == null)
            {
                throw new ArgumentNullException(nameof(classType));
            }

            if (!_validator.Validate(classType))
            {
                throw new ArgumentException($"{classType.FullName} is an illegal type");
            }

            var proxyType = _collection.GetProxyType(null, classType);

            if (proxyType == null)
            {
                lock (_sync)
                {
                    proxyType = _collection.GetProxyType(null, classType);
                    if (proxyType == null)
                    {
                        proxyType = _generator.GenerateProxyByClass(classType);
                    }

                    _collection.Add(null, classType, proxyType);
                }
            }

            return(proxyType);
        }
예제 #2
0
파일: Form1.cs 프로젝트: TimotejRybar/sdb
 private void btnCreate_Click(object sender, EventArgs e)
 {
     _people.Add(new Person());
 }