Beispiel #1
0
        public TypeDefinition Generate()
        {
            _startIndex = _model.Properties.Count;
            foreach (var property in _composedOfType.Properties)
            {
                var name = "$" + _instanceName + "$" + property.Name;
                var dbn  = _instanceName + property.Name;
                var pd   = TypeFactory.CreateProperty(name, PropAttr, property.PropertyType, _handler);
                foreach (var attribute in property.CustomAttributes)
                {
                    pd.CustomAttributes.Add(attribute);
                }
                if (pd.GetCustomAttribute(KnownTypesHandler.DbColumnAttribute) == null)
                {
                    pd.CustomAttributes.Add(_handler.GetDbColumn(dbn));
                }
                _model.Properties.Add(pd);
                _model.Methods.Add(pd.GetMethod);
                _model.Methods.Add(pd.SetMethod);

                var pi = new PropertyInformation {
                    PropertyDefinition = pd, FieldType = FieldType.Normal
                };
                var pp = new PropertyProcessor(pi, _model, _handler);
                pp.Process();
            }
            GenerateClass();
            return(_result);
        }
Beispiel #2
0
        private void ProcessProperty(PropertyInformation pi)
        {
            var pp = new PropertyProcessor(pi, _model, _handler);

            pp.Process();

            if (pi.IsComposedOf)
            {
                ProcessComposedOfAttribute(pi);
            }
        }