コード例 #1
0
        private void Write(ContainerNavigationProperty property)
        {
            WriteDeclaration(property);

            using (_builder.IndentBraced)
            {
                _("get");

                using (_builder.IndentBraced)
                {
                    _("if (this.{0} == null)", property.FieldName);
                    using (_builder.IndentBraced)
                    {
                        _("this.{0} = new {1}();", property.FieldName, property.InstanceType);
                        _("this.{0}.Initialize(this.Context, GetPath(\"{1}\"));", property.FieldName, property.ModelName);
                    }
                    _("");
                    _("return this.{0};", property.FieldName);
                }

                _("private set");

                using (_builder.IndentBraced)
                {
                    _("this.{0} = ({1})value;", property.FieldName, property.InstanceType);
                }
            }
        }
コード例 #2
0
ファイル: SourceCodeGenerator.cs プロジェクト: iambmelt/Vipr
        private void Write(ContainerNavigationProperty property)
        {
            WriteDeclaration(property);

            using (_builder.IndentBraced)
            {
                _("get");

                using (_builder.IndentBraced)
                {
                    _("if (this.{0} == null)", property.FieldName);
                    using (_builder.IndentBraced)
                    {
                        _("this.{0} = new {1}();", property.FieldName, property.InstanceType);
                        _("this.{0}.Initialize(this.Context, GetPath(\"{1}\"));", property.FieldName, property.ModelName);
                    }
                    _("");
                    _("return this.{0};", property.FieldName);
                }

                _("private set");

                using (_builder.IndentBraced)
                {
                    _("this.{0} = ({1})value;", property.FieldName, property.InstanceType);
                }
            }
        }
コード例 #3
0
ファイル: Property.cs プロジェクト: vikyding/Vipr
 public static NavigationProperty AsContainerNavigationProperty(OdcmProperty odcmProperty)
 {
     return(odcmProperty.IsCollection
         ? (NavigationProperty)ContainerNavigationCollectionProperty.ForService(odcmProperty)
         : ContainerNavigationProperty.ForService(odcmProperty));
 }