Skip to content

Commit

Permalink
16.02 - fewer docs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Jul 7, 2023
1 parent 6f6b2cf commit f5b59ee
Show file tree
Hide file tree
Showing 82 changed files with 723 additions and 4,713 deletions.
2 changes: 1 addition & 1 deletion 2sxc Docs Generator/pages/basics/query/parameters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ This shows how the In will look in the `Mod` stream to find the `PortalId`. Read
* [Set Query Parameters in your Code](xref:NetCode.DataSources.Use.QueryParameters)
<!-- * APIs
* [](xref:ToSic.Eav.DataSources.Queries.Query)
* [](xref:ToSic.Eav.DataSources.Queries.QueryDefinition)
* [](xref:ToSic.Eav.DataSource.Query.QueryDefinition)
* [](xref:ToSic.Eav.DataSources.Queries.QueryPartDefinition) -->
* [Blog Posts about VisualQuery Designer](https://2sxc.org/en/blog/tag/visual-query-designer)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ You will find a full explanation of this here: [](xref:Abyss.Parts.LookUp.Params
* [VisualQuery Designer](xref:Basics.Query.VisualQuery.Index)
<!-- * APIs
* [](xref:ToSic.Eav.DataSources.Queries.Query)
* [](xref:ToSic.Eav.DataSources.Queries.QueryDefinition)
* [](xref:ToSic.Eav.DataSource.Query.QueryDefinition)
* [](xref:ToSic.Eav.DataSources.Queries.QueryPartDefinition) -->
* [Blog Posts about VisualQuery Designer](https://2sxc.org/en/blog/tag/visual-query-designer)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Now you can loop through the data as you would otherwise, for example:

The data which defines a query is stored as IEntity data.

* So there is a header IEntity which is read through an [](xref:ToSic.Eav.DataSources.Queries.QueryDefinition).
* So there is a header IEntity which is read through an [](xref:ToSic.Eav.DataSource.Query.QueryDefinition).
* It contains the name, and a bunch of metadata IEntity items which are read as `QueryPartDefinition`s
* It also contains a list of [Connections](xref:ToSic.Eav.DataSources.Queries.Connection) which define how the DataSources pass data from one source to another.
* There are also test-parameters on such a query, which are only used for testing in the [VisualQuery Designer](xref:Basics.Query.VisualQuery.Index)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ uid: NetCode.DynamicCode.CreateInstance

# CreateInstance(...) Command

If you have external code you want to import you can use **CreateInstance**.
If you have external code you want to import you can use **CreateInstance**.

⚡ The [official API docs](xref:ToSic.Sxc.Code.ICreateInstance.CreateInstance*).
⚡ The [official API docs eg. on Razor14](xref:Custom.Hybrid.Razor14.CreateInstance*).

> [!IMPORTANT]
> In RazorPro, ApiPro and CodePro we use `GetCode(...)` instead of `CreateInstance(...)`.

[!include["Razor Tutorials"](~/shared/tutorials/razor.md)]
Expand Down Expand Up @@ -34,7 +37,7 @@ The code you will import is either another Razor page (`_*.cshtml`) or a C# code
## Also Read

* [](xref:Tut.Razor.Reuse)
* [](xref:AppsCatalog) - we suggest you check out some apps - almost all use this.
* [](xref:AppsCatalog) - we suggest you check out some apps - almost all use this.

## History

Expand Down
58 changes: 23 additions & 35 deletions 2sxc Docs Generator/pages/net-code/razor/typed/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ uid: NetCode.Razor.Typed.Index

# Typed Razor Components (v16) - DRAFT / WIP

> [!WARNING]
> These docs are still very messy and need some love, as they contain a lot of temporary
> wrong information.
Before v16 we focused on Razor code which extensively used `dynamic` objects.
This allowed a lot of neat, compact code such as `<div>@Content.Title</div>`
but in advanced scenarios resulted in many runtime issues which were hard to debug.
Expand Down Expand Up @@ -40,8 +44,8 @@ This forces the developer to be more explicit and helps avoid many hard to solve
* AsThing
* AsThings
* Built-in objects which are stacks, are explicitly named as such
* SettingsStack (previously `Settings`)
* ResourcesStack (previously `Resources`)
* AllSettings (previously `Settings`)
* AllResources (previously `Resources`)

## Not-available APIs any more

Expand Down Expand Up @@ -73,56 +77,40 @@ This forces the developer to be more explicit and helps avoid many hard to solve
* `someItem.Child(fieldName)` + overload
* `someItem.Parents(typeName)` + overload

MyData ?

* MyData.Item(...)
* MyData.Items(...)

* .Item ~~.Child(...)~~
* .Items ~~.Children(...)~~
* .Ref(...) ~~.Parent(...)~~
* .Refs(...) ~~.Parents(...)~~


TODO:

* Merge(...?) / Stack / MergeItems / **StackItems** / StackRead / AsStack / AsItemStack / AsThingStack(...)
* AsStack(..)

### Naming of Typed? Read? Thing? Object?

* IThing
* ITypedThing
* ITyped
* ITypedItem
* AsItem(...)
* AsItems(...)
* AsThing(...)
* AsThings(...)
* StackThings(...)
* MyModel.Thing(...)
* MyModel.Things(...)
* CreateInstance.Thing(...)
* CreateInstance.Things(...)
* AsStack(...)
* MyModel.Item(...)
* MyModel.Items(...)

### Settings / Resources TODO

* Settings
* ~~AllSettings~~
* ~~AllResources~~
* `SettingsStack`
* `ResourcesStack`
* ~~StackedSettings~~
* ~~MergedSettings~~
* Something.Settings - eg. `All.Settings`
* `AllSettings`
* `AllResources`


## Where Data Comes from in Typed Razor

* `Data.MyContent` - an `IEntity` containing the first (or demo) item which belongs to this block/module.
* `MyItem` - an `ITypedItem` containing the first (or demo) item which belongs to this block/module.
_previously_: `Content`
_typical use_: `var album = AsItem(Data.MyContent);`
* `Data.MyHeader` - an `IEntity` containing the Header settings (or demo) which belong to this block/module.
_typical use_: `</div>@MyItem.Html("Body")</div>`
* `MyHeader` - an `IEntity` containing the Header settings (or demo) which belong to this block/module.
_previously_: `Header`
_typical use_: `var album = AsItem(Data.MyHeader);`
* `Data.MyData` - an `IEnumerable<IEntity>` containing all items (or none, or one demo-item) belonging to this block/module.
_typical use_: `<h2>@MyHeader.String("Title")</h2>`
* `MyItems` - an `IEnumerable<IEntity>` containing all items (or none, or one demo-item) belonging to this block/module.
_previously_: `Content` or `Data` (this caused some confusion)
_typical use_: `var list = AsItems(Data.MyContent);`
_typical use_: `@foreach (var item in MyItems) { ...}`
* `Data`, `Data["Default"]` or `Data["some-stream-name]` lists/streams containing all items given to the block/module.
* if the view is configured to use a **Query** then the query will provide these streams
* if the view is configured to not use a Query, but just use data added by the user, then this contains the same data as `Data.MyData`
Expand Down Expand Up @@ -160,7 +148,7 @@ The exact list is still WIP!! TODO:

| API of Previous Razors | Old Behavior | New Behavior | Replacement |
| ---------------------- | ------------------------------------------------ | ------------------------------------------------- | ----------- |
| Content | `dynamic` object pointing to the first / main item | Disabled, should throw error if used TODO: | Data.MyContent (an IEntity) |
| Content | `dynamic` object pointing to the first / main item | Disabled, should throw error if used TODO: | `MyItem` |
|
| Settings
| Resources
Expand Down
Loading

0 comments on commit f5b59ee

Please sign in to comment.