Good to hear that you got it running.
Alas, it's a bit tricky to get everything right for now.
The "real" typed model support in Umbraco isn't in the core for 6.1.x, so you'll have to make your own default controller etc.
If you're brave enough to run on 6.2 nightly, you can use the "WhileWaitingForSixTwo" project from my 7.0.modelsupport branch.
That will give you the models as IPublishedContent implementations, and they have .Children of the typed models.
You can for instance do:
@inherits UmbracoViewPage<Page>
<ul>
@foreach(var post in Model.Children.OfType<Post>())
{
<li>@post.PostProperty</li>
}
</ul>
If you need setters, you can create your own property body generator class and override the factory used by codegen. Basically you can have whatever code you want if you do the (small amount of) work needed.
Code gen general
Hi,
I'm look for a tool that scans my DataTypes and creates c# classes of it.
Now I'm doing this by hand and it's taking way to much time.
How can I get CodeGen up and running on a 6.12 installation.
Also I have no knowledge what uSync is.
Cheers,
nojaf
Ok I've managed to install the Codegen package. And I got everything running. But unfortunately the generated code doesn't fit my needs.
I was hoping that the properties would look like:
code
I really need a Setter to all the classes. And what I also miss is a list of Child items if so defined.
Don't get me wrong, the package is amazing but it's unusable for the project I'm building.
Good to hear that you got it running.
Alas, it's a bit tricky to get everything right for now.
The "real" typed model support in Umbraco isn't in the core for 6.1.x, so you'll have to make your own default controller etc.
If you're brave enough to run on 6.2 nightly, you can use the "WhileWaitingForSixTwo" project from my 7.0.modelsupport branch.
That will give you the models as IPublishedContent implementations, and they have
.Children
of the typed models. You can for instance do:If you need setters, you can create your own property body generator class and override the factory used by codegen. Basically you can have whatever code you want if you do the (small amount of) work needed.
See https://github.com/lars-erik/Umbraco.CodeGen/wiki/Parsing-and-Generating-code
Here's the code that currently generates the property body: https://github.com/lars-erik/Umbraco.CodeGen/blob/master/Umbraco.CodeGen/Generators/PropertyBodyGenerator.cs
If it's too much work for you, stay tuned for coming Umbraco releases for full-fledged support. :)
(6.2+, 7.?)
is working on a reply...