Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template tools spike #3

Merged
merged 20 commits into from
Mar 10, 2018
Merged

Template tools spike #3

merged 20 commits into from
Mar 10, 2018

Conversation

tpluscode
Copy link
Contributor

No description provided.

@@ -67,7 +68,12 @@ public Brochure CreateBrochure(EntityWrapper<BrochureEntity> source)
{
var target = new Brochure
{
Id = this.templates.CreateBrochureIdentifier(source.Entity.Id)
Id = IdentifierOf<Brochure>.Bind(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IdentifierOf<T>#Bind definitely need an object overload for using like

IdentifierOf<Brochure>.Bind(new { id: source.Entity.Id })

{
["id"] = source.Entity.Id
},
this.configuration.BaseResourceNamespace)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This where the caller can add a base URI to append to the template

@@ -44,7 +48,7 @@ public Magazine GetMagazine(Uri identifier)
[return: AllowNull]
public Brochure GetBrochure(Uri identifier)
{
var id = this.identifierRetriever.GetBrochureId(identifier);
var id = IdentifierOf<Brochure>.Match(identifier, this.config.BaseResourceNamespace).Get<int?>("id");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with the base. If the identifier is a complete URI it is possible to add it. Only needed when the actual template is a just the path

@@ -32,7 +31,7 @@ public SourcesModule(ISourcesRepository repository, IWikibusConfiguration config

this.ReturnNotFoundWhenModelIsNull();

this.Get(Id.BrochurePath, r => this.GetSingle(repository.GetBrochure));
this.Get<Brochure>(r => this.GetSingle(repository.GetBrochure));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inheriting from ArgolisModule makes it possible to add actions without specifying the path. It's taken from the attribute

Conflicts:
	paket.dependencies
	paket.lock
	src/data.wikibus.org/Web.config
	src/data.wikibus.org/data.wikibus.org.csproj
	src/wikibus.nancy/EntryPoint.cs
	src/wikibus.nancy/app.config
	src/wikibus.nancy/paket.references
	src/wikibus.nancy/wikibus.nancy.csproj
	src/wikibus.org/wikibus.org.csproj
	src/wikibus.purl.nancy/wikibus.purl.nancy.csproj
	src/wikibus.sources.EF/EntityFactory.cs
	src/wikibus.sources.EF/IdRetriever.cs
	src/wikibus.sources.EF/SourceRepositoryExtensions.cs
	src/wikibus.sources.EF/SourcesRepository.cs
	src/wikibus.sources.EF/paket.references
	src/wikibus.sources.EF/wikibus.sources.EF.csproj
	src/wikibus.sources.dotNetRDF/SourcesRepository.cs
	src/wikibus.sources.dotNetRDF/paket.references
	src/wikibus.sources.dotNetRDF/wikibus.sources.dotNetRDF.csproj
	src/wikibus.sources.nancy/SourcesModule.cs
	src/wikibus.sources.nancy/app.config
	src/wikibus.sources.nancy/paket.references
	src/wikibus.sources.nancy/wikibus.sources.nancy.csproj
	src/wikibus.sources/Book.cs
	src/wikibus.sources/Brochure.cs
	src/wikibus.sources/ISourcesRepository.cs
	src/wikibus.sources/IdentifierTemplates.cs
	src/wikibus.sources/Issue.cs
	src/wikibus.sources/Magazine.cs
	src/wikibus.sources/paket.references
	src/wikibus.sources/wikibus.sources.csproj
	src/wikibus.tests/Modules/Bindings/GettingSourcesSteps.cs
	src/wikibus.tests/Modules/Bindings/NancyDependencies.cs
	src/wikibus.tests/paket.references
	src/wikibus.tests/sources.EF/EntityFrameworkSourceTestContext.cs
	src/wikibus.tests/wikibus.tests.csproj
	src/wikibus.vehicles.nancy/wikibus.vehicles.nancy.csproj
@tpluscode tpluscode merged commit ebe9f8f into master Mar 10, 2018
@tpluscode tpluscode deleted the template-tools-spike branch March 10, 2018 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant