예제 #1
0
        public void Start(string prefix, MappedPropertyInfo item)
        {
            CodeFileBuilder componentBuilder = new CodeFileBuilder();

            componentBuilder.Indent(5);
            const string subPrefix = "y.";
            HbmComponent component = item.HbmObject <HbmComponent>();

            componentBuilder.AddLine("");

            var componentBodyBuilder = new ClassMapBody(componentBuilder);

            foreach (var componentPart in component.Items)
            {
                componentBodyBuilder.Add(subPrefix, new MappedPropertyInfo(componentPart, item.FileName));
            }
            _builder.StartMethod(prefix, string.Format("{0}<{1}>(x => x.{2}, y=>", FluentNHibernateNames.Component, item.ReturnType, item.Name));
            _builder.AddLine("{");
            _builder.AddLine(componentBuilder.ToString());
            _builder.AddLine("})");
            if (component.insert)
            {
                _builder.AddLine(string.Format(".{0}()", FluentNHibernateNames.Insert));
            }
            if (component.update)
            {
                _builder.AddLine(string.Format(".{0}()", FluentNHibernateNames.Update));
            }
        }
예제 #2
0
        public void Start(string prefix, MappedPropertyInfo item)
        {
            CodeFileBuilder componentBuilder = new CodeFileBuilder();
            componentBuilder.Indent(5);
            const string subPrefix = "y.";
            HbmCompositeElement component = item.HbmObject<HbmCompositeElement>();
            componentBuilder.AddLine("");

            var componentBodyBuilder = new ClassMapBody(componentBuilder);
            foreach (var componentPart in component.Items)
            {
                componentBodyBuilder.Add(subPrefix, new MappedPropertyInfo(componentPart, item.FileName));
            }
            _builder.StartMethod(prefix, string.Format("{0}<{1}>(x => x.{2}, y=>", FluentNHibernateNames.CompositeElement, item.ReturnType, item.Name));
            _builder.AddLine("{");
            _builder.AddLine(componentBuilder.ToString());
            _builder.AddLine("})");
            /*if (component. )
            {
                _builder.AddLine(string.Format(".{0}()", FluentNHibernateNames.Insert));
            }
            if (component.update)
            {
                _builder.AddLine(string.Format(".{0}()", FluentNHibernateNames.Update));
            }*/
        }