Constructor in generated code
No edit summary |
(Automatically adding template at the end of the page.) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
There are different kinds of operation methods: | |||
[[File:2021-10-14 18h31 05.png|none|thumb]] | [[File:2021-10-14 18h31 05.png|none|thumb]] | ||
[[File:2021-10-14 18h27 52.png|none|thumb|692x692px]] | [[File:2021-10-14 18h27 52.png|none|thumb|692x692px]] | ||
To create a constructor | To create a constructor, first, add a normal method, then change the <code>operationKind</code> to constructor. | ||
In generated code you will get this: | In generated code, you will get this: | ||
public partial class Class1 | public partial class Class1 | ||
{ | { | ||
Line 13: | Line 13: | ||
} | } | ||
Normally when doing a constructor for "live" objects you will want to send in IEcoServiceProvider and call the main constructor we provide like this: | Normally, when doing a constructor for "live" objects, you will want to send in IEcoServiceProvider and call the main constructor we provide like this: | ||
public Class1(IEcoServiceProvider serviceProvider, Class2 aClass2): this(serviceProvider) | public Class1(IEcoServiceProvider serviceProvider, Class2 aClass2): this(serviceProvider) | ||
{ | { | ||
} | } | ||
[[Category:MDriven Framework]] | [[Category:MDriven Framework]] | ||
{{Edited|July|12|2024}} |
Latest revision as of 15:29, 10 February 2024
There are different kinds of operation methods:
To create a constructor, first, add a normal method, then change the operationKind
to constructor.
In generated code, you will get this:
public partial class Class1 { [UmlElement(Id = "c8111515-b7a5-4b9b-87f9-4a19261c8bd8")] public Class1(Class2 aClass2) { } }
Normally, when doing a constructor for "live" objects, you will want to send in IEcoServiceProvider and call the main constructor we provide like this:
public Class1(IEcoServiceProvider serviceProvider, Class2 aClass2): this(serviceProvider) { }
This page was edited more than 11 months ago on 02/10/2024. What links here