blipson89 / synthesis Goto Github PK
View Code? Open in Web Editor NEWSynthesis is a universal object mapper for Sitecore
License: MIT License
Synthesis is a universal object mapper for Sitecore
License: MIT License
Hi @kamsar ,
I've got a question about Synthesis: if there is a way to get a synthesis type via a template?
Being more concrete, I want to use a method which looks like this:
public Type GetSynthesisTypeBy(ID templateId) { ... }
And so having the ISampleItemItem ("/sitecore/templates/Sample/Sample Item" from out-of-the-box Sitecore) I want to get its type like this:
var template = GetSynthesisTypeBy(new ID("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}")); // typeof(ISampleItemItem)
I am using Sitecore 8.2 and Synthesis 8.2.5.
I have a content item that is using a Treelist field to grab images out of the content tree. Synthesis generates this field as an IItemReferenceListField. In the ModelRegistration class for this module, I add the Image system template (/sitecore/Templates/System/Media/Unversioned/Image). My question is how do I get the images from this field strongly typed to that template (IImageItem).
This is what I've tried (in addition to a couple of similar variations)
var model = RenderingContext.Current.ContextItem.As<I_ModelItem>();
var images = (IEnumerable<IImageItem>) model.Images.TargetItems.AsEnumerable();
When I try this, I get the following error: Unable to cast object of type 'System.Collections.ObjectModel.ReadOnlyCollection1[Synthesis.IStandardTemplateItem]' to type 'System.Collections.Generic.IEnumerable
1[Company.Feature.Module.Models.System.Module.Unversioned.IImageItem]'.
Some way for the app to determine if a template is inheriting from itself or a circular reference. Maybe log it in the generated classes or exclude that from the model. Would be helpful tracking down if a developer accidentally configures the templates in Sitecore or Rocks.
Thanks!
Could we make _assemblies protected, so that it is easier to override GetTypesInRegisteredAssemblies.
Thanks
Given a Sitecore Content item that implements Project Template1, which implements Feature Template2...
I have generated a model for Template2 and am trying to render an item from that template with:
@using Synthesis.Mvc.Helpers
@model MyCompany.Feature.ProductPage.Models.Concrete.Feature.Template2._Template2
@Html.TextFor(m => m.Field)
But I get the error that I am using the wrong model and I am not sure what I am doing wrong.
The model item passed into the dictionary is of type 'Synthesis.StandardTemplateItem', but this dictionary requires a model item of type 'MyCompany.Feature.ProductPage.Models.Concrete.Feature.Template2._Template2'.
Any ideas on why would the item insist that it is a StandardTemplateItem? Do I need to generate a model for Template1?
Sitecore 8.2 initial
Synthesis 8.2.5
Helix structure
This is not a bug, maybe would be an enhancement.
While working with modular project and Standard Rendering Parameters I have found that Synthesis will generate IStandardRenderingParameters in the first project it finds usage of that template.
By default, the first project is Foundation.Theming one, and this one is referenced by pretty much all features.
Now imagine scenario, where you create another Foundation.MyProject. Since M is before T in alphabet, the IStandardRenderingParameters will be created in this project, breaking all models in all Features (because not all features will reference MyProject)
I do not know if I explained that correctly :)
The improvement here would be to consider Standard Rendering Parameters similarly to StandardTemplate and provide base in Synthesis namespace ?
Hey Kam,
I've run into an issue in my current Sitecore solution (Sitecore 8.2 and Synthesis 8.2.5). I have a template in the Project layer whose base templates are two different interfaces (one from Feature, one from Foundation). Now, when I go to write code in a Feature controller whose datasource item uses this template, I can only cast it to one of the two interfaces (because the actual template model is located in the Project layer).
Is there a way to get a model for this item without referencing the Project layer model? It would be nice to be able to get both the Feature and Foundation models out of this single datasource item.
Thanks!
It'd make sense for IRenderingContext to also have and implement IContextIndex, which will resolve the index for the datasource or context item, similarly to IContextDatabase. This should improve testability of indexing code.
I am trying to figure out how to get at rendering parameters. Does something like a GetRenderingParameters method exist, or is there a recommended way to do this?
Synthesis.Mvc and the model provider are awesome, and make up most of my daily usage of Synthesis, but are barely mentioned in the README. Alter the readme to lead with a discussion of how it works with view and controller renderings, because c'mon we're barely even using .As<T>()
any longer ;)
I noticed that the current iteration has "Item" as the suffix of all Interfaces (ex: ILandingPageItem) but not the concrete classes: (ex: ILandingPage)
My thinking on the matter was that it would be better to invert that convention to comply more closely with Sitecore's CustomItem convention, which has concrete objects that end in Item (ex: MediaItem). This would have the side effect of making most code more terse, assuming a contract-based approach to using Synthesis.
However... Further thought leads me to believe that this would be a consumer-based convention, and that Synthesis should have a setting allowing the suffix to be included/disabled on Interfaces or Concretes.
Synthesis' codegen is a bit dated and bulky. On top of that, it doesn't seem like it needs to be a part of Synthesis. There's a clean separation of responsibilities here, and Leprechaun fits that new role.
Currently the system attempts to put the log in the project, but what if it can't access the project? Since Synthesis requires a running instance of Sitecore, it makes sense to have a dedicated Log4Net log file in the $data/logs folder just for Synthesis, which would allow for guaranteed debugging possibilities.
In my Habitat-like demo project, I have not been able to get multiple configurations to work out. Maybe I'm doing something wrong, but here's what's happening...
First, I have a feature project for Metadata that includes a base template with fields like Page Title, Meta Description, etc. In Habitat-style, this project contains all of the Unicorn and Sitecore configuration, controller, model, view, etc for this feature so I'd like to have the Synthesis code (interfaces and models) generate into this project.
I also have a "project layer" project that includes all of my page templates (the ones content authors will actually create instances of in Sitecore). These inherit from the Metadata template.
If I only configure Synthesis for the Metadata project, then my page which uses a page template from the latter project cannot be cast to the IMetadata interface ( Sitecore.Context.Item.As() ). Whenever I set up a Synthesis configuration for the other project, I get models that inherit from IMetadata but code inside of the Metadata project still cannot cast to IMetadata. I presume because that project doesn't reference the project containing the concrete implementation? (the dependencies have to flow the other direction - the page templates project can depend on the metadata project, but not the other direction).
I did try changing the order that the configurations are defined and the assemblies get added to the ConfigRegistrar, but that generated code that wouldn't compile (the page templates try to inherit from IMetadata in some weird looking namespace).
I have all of this in a smallish demo project that I can share if you want to look at it or if you want to jump on a screenshare session sometime... You can hit me up on Sitecore Slack as @kevin-williams.
Templates from friend metadata are treated as desyncs by the sync engine. Generation is not affected so this is to some extent a cosmetic issue.
Hi Kam,
I know I am the annoying guy :)
Anyway in SynthesisConfigurationRegistration the method LoadTemplateInputProviderFromConfig has a hardcoded reference to ConfigurationTemplateInputProvider. This should be loaded through the configurationation file. Otherwise it is not possible to replace the ITemplateInputProvider.
Cheers
Jens
We are trying to use the GetSynthesisQueryable methods as below
context.GetSynthesisQueryable(). We get the below error.
Type of context is IProviderSearchContext.
Exception Details: System.NotImplementedException: At this time Synthesis only supports Lucene indexes. This works with lucene index.
We expect GetSysthesisQueryable to work with SOLR.
Sitecore Version: 8.1 Update 1
Synthesis Version: 8.2.6
SOLR Version: 5.3.1
Do you want to request a feature or report a bug?
I want to report a bug.
What is the current behavior?
I have deployed the appropriate the configuration files that came Syntehsis 8.2.6.
I have defined the z.DevSettings.config with the following:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<sc.variable name="sourceFolder" value="C:\tfs\sitecore\BHFoundation\DEV\src"/>
</sitecore>
</configuration>
However, the models are generated under the systemdrive root instead.
If the current behavior is a bug, please provide the steps to reproduce.
I run the /synthesis.aspx where it reports that a few templates are not synchronized. Clicking Regenerate, succeeds and report success.
What is the expected behavior?
I would expect the files to be generated under the sourceFolder root, or error shown.
Please mention your Sitecore version and Synthesis version.
I am using Sitecore 8.2 Update 3 with Synthesis 8.2.6.
It would be nice if the documentation included what to deploy to productions servers in terms of the configuration files.
Do we deploy any of them ? or just MVC is enough ?
System.IO.DirectoryNotFoundException: Could not find a part of the path.. blah blah.
Shouldn't it create missing directories ?
One of the directories in the path is missing. Exception happens.
Web Test Runner is old and a pain to use. This should be replaced with something that makes unit testing easier to work with. Sitecore FakeDB should be able to replace most of this.
Consider altering the link URL resolution property to use LinkField.GetFriendlyUrl()
. This method is built in, handles a few situations the current link resolution code does not, and can make things simpler.
Would be nice to have to be able for example do:
query.DoesNotContainOr(q => q.AncestorIds, myEnumerableOfAncestorIdsToExclude)
Do you want to request a feature or report a bug? Unknown at this point.
What is the current behavior? In the middle of an upgrade to sitecore version 9, getting an error from synthesis: An item with the same key has already been added. I havent looked much into it yet. I wanted to know if Synthesis is expected to work in sitecore version 9?
If the current behavior is a bug, please provide the steps to reproduce. unknown at this point
What is the expected behavior?
Please mention your Sitecore version and Synthesis version. synthesis 8.2.6, sitecore version 9
I'm trying to use a variable defined in a dev patch file that allows the dev to specify the source root folder. We don't use the webroot as the source root. Unicorn let's me do this. With Synthesis it is passed along as a string.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<synthesis>
<providers>
<generatorParametersProvider type="Synthesis.Configuration.ConfigurationGeneratorParametersProvider, Synthesis">
<ItemOutputPath>$(sourceRoot)/Website/Code/Synthesis/Synthesis.Model.Concrete.cs</ItemOutputPath>
<InterfaceOutputPath>$(sourceRoot)/Website/Code/Synthesis/Synthesis.Model.cs</InterfaceOutputPath>
</generatorParametersProvider>
</providers>
</synthesis>
</sitecore>
</configuration>
Here's an example image:
https://dl.dropboxusercontent.com/u/6237857/blanks-on-translated-site.png
I was able to fix a similar issue by forcing Versions.Count > 0 in Synthesis's GetChildren(), but that doesn't help with the components being loaded on the page.
Even so, that seems like a work around for a Sitecore bug. Why is Sitecore's GetChildren() returning items that don't exist in the page's language?
Feature request
Currently the item extensions only look for the direct TemplateId of the item, and not at the base templates (or deeper): Synthesis.ItemExtensions.As<_Template>(bool derived)
It would be nice if the Synthesis extensions look for derived templates. Example (from habitat):
`private static bool IsDerived(this Item item, Item templateItem)
{
if (item == null)
{
return false;
}
if (templateItem == null)
{
return false;
}
var itemTemplate = TemplateManager.GetTemplate(item);
return itemTemplate != null && (itemTemplate.ID == templateItem.ID || itemTemplate.DescendsFrom(templateItem.ID));
}`
Sitecore version: 8.2.160729
Synthesis version: 8.2.2-RC02
Hey Kamsar,
Great work with the module.
I am trying to override the ConfigurationTemplateInputProvider, so that an exception isn't thrown if the root of the template root item isn't found. E.g. I might have a root saying /sitecore/templates/feature.
When I first install Sitecore this item isn't present, and I get the error Synthesis Config Error: The path /sitecore/Templates/Feature did not map to a valid item
And I am unable to sync TDS in because of this. So I want to ignore it, if the item isn't present.
To do this I try and override ConfigurationTemplateInputProvider. At first I just want to override ResolveSpecToItems(string input, IEnumerable possibilities), but this is private. Then I think I can override RefreshSpecTargets() but this isn't virtual. Then I want to override CreateTemplateList(), but I cannot access the private properties _templates, which makes it a little harder (all though I can create my own, but it could be used elsewhere).
Is it possible to make the method protected virtual and/or the properties protected?
Thanks
Jens
I will like that synthesis not create backup if the flag MaxBackupCopies on synthesys.config is 0 (zero)
When the MaxBackupCopies = 0 the synthesis get a infinite loop
on file located in Synthesis\Generation\CodeDom\CodeDomGenerator.cs
for the method WriteFileWithBackups i will like do this change
if (File.Exists(path)) // existing version present; make backups as necessary
{
uint maxBackups = _parameters.MaxBackupCopies;
if (maxBackups == 0) return;
Hey there.
I found an issue that when the path for the generated models is defined escaping from the webroot (e.g. "~/../something), the model generation hangs. If I change the path to be inside the webroot, everything works well.
This might apply to some other field types as well, presumably InnerField is null.
Just dropping in the bug we noticed around Synthesis in a production CD environment with the master db and master indexes removed.
"FieldNameTranslator is only used during generation and thus should not need to be changed in CD, but does as it currently stands due to the eager dependency resolution."
4244 16:57:25 ERROR Error Initializing ProjectA.Model.Custom.CurrentPageBaseModel
Exception: System.TypeInitializationException
Message: The type initializer for 'Synthesis.Initializers' threw an exception.
Source: Synthesis
at Synthesis.ItemExtensions.As[TTemplate](Item item)
at ProjectA.Model.Custom.CurrentPageBaseModel.Initialize(Rendering rendering) in d:\Websites\ProjectA\ProjectA.Model\Custom\CurrentPageBaseModel.cs:line 15
Nested Exception
Exception: System.ArgumentException
Message: Index sitecore_master_index was not found
Source: Sitecore.ContentSearch
at Sitecore.ContentSearch.ContentSearchManager.GetIndex(String name)
at Synthesis.Configuration.ProviderResolver.LoadFieldNameTranslatorFromConfig()
at Synthesis.Configuration.ProviderResolver..ctor()
at Synthesis.Configuration.ProviderResolver.get_Current()
at Synthesis.Initializers..cctor()
Setting: indexConfiguration name="sitecore_web_index"
For development, it would be quite handy to have the option to enable an item:saved
event handler that, when a template or field item was saved, queued a regeneration of the Synthesis model.
The queue should be rolling async (e.g. templates tend to fire lots of saves in rapid succession, we need to debounce the event - waiting 1-2 seconds before going is probably a good idea.
Also should have it disabled by default, since it should never go to prod where the model files won't - or shouldn't - exist to get updated.
if (rendering.RenderingType == "Layout") return
This causes invalid HTML5 with a comment before the doctype when debugging is enabled. Suboptimal.
Feature request
Create an overloadable/extra argument for all the Synthesis.Mvc.Helpers. In some cases it can be useful if you can pass a different model other then the one currently in the viewdata. Now they all do:
ITextField textField = selector(helper.ViewData.Model);
Sitecore version: 8.2.160729
Synthesis version: 8.2.2-RC02
Do you want to request a feature or report a bug?
This is a bug or possibly a lack of documentation. Also, it's possible that the problem is betweena keyboard and chair (aka me).
What is the current behavior?
I have a Sitecore solution based on Helix and a number of multi-site projects. The Foundation.* and Feature.* layer modules and their models are in their corresponding dlls and deployed to target instance via update packages. The Project layer module which represents one subsite (individual site element) has a model-registration correctly. It is managed as a separate solution which also includes Foundation.* and Feature.* module NuGet package dependencies.
My intent was to make sure that synthesis maps all of the templates and models in code for all layers, but only generates models for Project Layer only as the Feature/Foundation models are already synchronized and its source code is not part of the working solution.
Here is the configuration I used to limit the template synchronization:
Base configuration (Foundation.Synthesis.config):
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<synthesis>
<providers>
<typeListProvider type="Synthesis.Configuration.ConfigurationTypeListProvider, Synthesis">
<assemblies hint="list:AddAssembly">
<foundation>*.Foundation.*</foundation>
<feature>*.Feature.*</feature>
</assemblies>
</typeListProvider>
</providers>
</synthesis>
<settings>
<setting name="Synthesis.ModelOutputBasePath" value="$(sourceFolder)\" />
</settings>
<pipelines>
<initialize>
<!-- Get rid of Synthesis default configuration -->
<processor type="Synthesis.Pipelines.Initialize.SynthesisConfigRegistrar, Synthesis">
<patch:delete />
</processor>
<!-- IMPORTANT: Each registrar instance must have a unique hint value for the patch to work correctly. -->
<processor type="Synthesis.Pipelines.Initialize.SynthesisConfigRegistrar, Synthesis" hint="banner">
<assemblies hint="list:AddAssembly">
<foundation>*.Foundation.*</foundation>
<feature>*.Feature.*</feature>
</assemblies>
</processor>
</initialize>
</pipelines>
</sitecore>
</configuration>
Project Layer patch to modify base configuration (Project..Webiste.config):
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<synthesis>
<providers>
<templateInputProvider type="Synthesis.Configuration.ConfigurationTemplateInputProvider, Synthesis">
<excludedTemplates hint="list:AddTemplateExclusion">
<foundation>/sitecore/templates/Foundation/*</foundation>
<feature>/sitecore/templates/Feature/*</feature>
</excludedTemplates>
</templateInputProvider>
<typeListProvider type="Synthesis.Configuration.ConfigurationTypeListProvider, Synthesis">
<assemblies hint="list:AddAssembly">
<foundation></foundation>
<feature></feature>
<project>*.Project.*.Website</project>
</assemblies>
</typeListProvider>
</providers>
</synthesis>
<pipelines>
<initialize>
<processor type="Synthesis.Pipelines.Initialize.SynthesisConfigRegistrar, Synthesis" hint="banner">
<assemblies hint="list:AddAssembly">
<project>*.Project.*.Website</project>
</assemblies>
</processor>
</initialize>
</pipelines>
</sitecore>
</configuration>
If the current behavior is a bug, please provide the steps to reproduce.
I am seeing that all models are being re-generated when using the configuration provided above where I am attempting to exclude the templates from Feature and Foundation layer modules.
What is the expected behavior?
My expectation was to although it sees synchronized modules for all Layers, the generation phase will utilize the excludedTemplatePath element to ignore Foundation/Feature layer modules.
Please mention your Sitecore version and Synthesis version.
Sitecore 8.2 Update 3 + Synthesis 8.2.6
Hi, I noticed that the class AutoSyncModule tries to resolve paths with ~ (e.g. ~/../Project/Project.csproj) by using File.Exists only, this causes an error as it is not an absolute path. Perhaps it would be good idea to use Server.MapPath before File.Exists.
Thanks
Reset cacheability to false, review approach. Has some good ideas.
It'd be nice to have a Synthesis analog to @Html.Sitecore().BeginField()
/EndField()
e.g. for general links
The ContentSearch aspects of Synthesis should act on a plugin basis. This will ease the addition of Solr, and remove Lucene dependencies from the core.
Ref: #21
We sometimes get this exception on site load after app pool recycle but goes away on the 2nd request. Is this something you have seen before? I don't have a problem hitting the /Synthesis.aspx page.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Synthesis.Utility.TypeCollectionUtility.WithAttribute(IEnumerable`1 types) +80
Synthesis.Synchronization.SynchronizationEngine.get_ModelDictionary() +77
Synthesis.Synchronization.SynchronizationEngine.IsTemplateSynchronized(ITemplateInfo template) +38
Synthesis.Synchronization.SynchronizationEngine.AreTemplatesSynchronized() +211
Synthesis.<>c__DisplayClass1_0.<CheckSyncAll>b__0(IProviderConfiguration configuration, TemplateGenerationMetadata metadata) +30
Synthesis.SynthesisHelper.ExecMetadataWithAutoFriending(IEnumerable`1 configurations, Action`2 processAction) +332
Synthesis.SynthesisHelper.CheckSyncAll() +107
Synthesis.Pipelines.Initialize.CheckModelSynchronization.DoLogSync() +32
Synthesis.Pipelines.Initialize.CheckModelSynchronization.Process(PipelineArgs args) +87
(Object , Object[] ) +56
Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters) +36
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +162
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +18
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args) +18
Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args) +49
Sitecore.Nexus.Web.HttpModule.Application_Start() +156
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +472
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +536
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Object reference not set to an instance of an object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9963380
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254```
I've got a General Link field whose value is "/Document-Library/Search-Results?q=Something". The inner field has type="internal" but I guess because of the query string, the target ID is empty. This causes FieldUtility.GetGeneralLinkHref to incorrectly return the empty string, which causes the HyperlinkField's Href and HasValue properties to be incorrect.
((IExternalDocumentReferenceEntity)file).DocumentLink
{}
[Synthesis.FieldTypes.HyperlinkField]: {}
CssClass: ""
Href: ""
Target: "_blank"
TargetItem: null
Text: ""
Title: ""
((IExternalDocumentReferenceEntity)file).DocumentLink.HasValue
false
((IExternalDocumentReferenceEntity)file).DocumentLink.RenderedValue
""
((IExternalDocumentReferenceEntity)file).DocumentLink.ToLinkField()
{Sitecore.Data.Fields.LinkField}
base {Sitecore.Data.Fields.XmlField}: {Sitecore.Data.Fields.LinkField}
Anchor: ""
Class: ""
InternalPath: "/sitecore/content/Document-Library/Search-Results?q=MSDS"
IsInternal: true
IsMediaLink: false
LinkType: "internal"
MediaPath: ""
QueryString: "q=MSDS"
Target: "_blank"
TargetID: {00000000-0000-0000-0000-000000000000}
TargetItem: null
Text: ""
Title: ""
Url: "/Document-Library/Search-Results?q=MSDS"
When requesting /synthesis.aspx it throws this exception. Unfortunately I don't have some steps to reproduce:
[ArgumentNullException: Value cannot be null. Parameter name: fieldTypeName] Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName) +63 Sitecore.ContentSearch.SolrProvider.SolrFieldMap.GetFieldConfigurationByFieldTypeName(String fieldTypeName) +40 Sitecore.ContentSearch.SolrProvider.SolrFieldNameTranslator.ProcessFieldName(String fieldName, Type returnType, CultureInfo culture, String returnTypeString, Boolean aggressiveResolver) +1319 Sitecore.ContentSearch.SolrProvider.SolrFieldNameTranslator.GetIndexFieldName(String fieldName) +31 Synthesis.Generation.MetadataGenerator.GenerateMetadata() +868 Synthesis.SynthesisHelper.ExecMetadataWithAutoFriending(IEnumerable
1 configurations, Action2 processAction) +467 Synthesis.SynthesisHelper.CheckSyncAll() +181 Synthesis.ControlPanel.ControlPanelPipelineProcessor.CreateSyncSummary() +110
Hey there. I hope this is not a stupid question but I have been unable to use the GetResults() method at the end of a query when using GetSynthesisQueryable. Doing so returns a System.NullReferenceException.
For example:
using (var context = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext())
{
var results = context.GetSynthesisQueryable()
.GetResults();
}
I am successfully able to use other methods like GetFacets() and ToList(). Hopefully I am just missing something but let me know if you have any ideas.
I am using the latest version of Sitecore 7.1 (130926)
Kam,
My project is in github and I downloaded it to a different machine than I created it on. I have the same development environment (VS2015 Community) and the same Synthesis v8.2.5. However when I build the solution, deploy it and refresh the website I get the following error. What am I doing wrong?
Unable to cast object of type 'System.String' to type 'Synthesis.Templates.ITemplateInputProvider'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'Synthesis.Templates.ITemplateInputProvider'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.String' to type 'Synthesis.Templates.ITemplateInputProvider'.]
Synthesis.Configuration.ConfigurationProviderConfiguration.LoadTemplateInputProviderFromConfig() +45
Synthesis.Configuration.ConfigurationProviderConfiguration.get_TemplateInputProvider() +108
Synthesis.SynthesisHelper.ExecMetadataWithAutoFriending(IEnumerable1 configurations, Action
2 processAction) +230
Synthesis.SynthesisHelper.CheckSyncAll() +161
Synthesis.Pipelines.Initialize.CheckModelSynchronization.DoLogSync() +45
(Object , Object[] ) +71
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Nexus.Web.HttpModule.Application_Start() +227
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +673
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +618
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343
[HttpException (0x80004005): Unable to cast object of type 'System.String' to type 'Synthesis.Templates.ITemplateInputProvider'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731
In a modular style site, there will be many Synthesis configurations. During many rebuilds some of the models will remain unchanged.
If we check for (content) changes before writing the updated file we can avoid changing the file timestamp which makes Visual Studio rebuild every project with a model. This will speed up compiles after generation significantly :)
Hi,
I am trying out Synthesis, very nice work, however I tried adding Items synthesis-style, but found that it didn't work.
from readme;
// add a new subitem
var editing = foo.Add<ISampleItemItem>("Hello world");
But it seems that, that function requires a concrete class (from the code);
https://github.com/kamsar/Synthesis/blob/master/Source/Synthesis/StandardTemplateItem.cs#L405
@Html.HyperlinkFor(x=>x.Linky, linkText:"Monkeys!")
Thanks @Gadensgaard for detecting this :)
[FileNotFoundException: Could not load file or assembly 'MethodTimer, Version=1.15.10.0, Culture=neutral, PublicKeyToken=cb1364609f40a1dc' or one of its dependencies. The system cannot find the file specified.] System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +191 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +162 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +148 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +604 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) +212 Synthesis.Utility.TypeCollectionUtility.WithAttribute(IEnumerable
1 types) in C:\Web\Synthesis\Source\Synthesis\Utility\TypeCollectionUtility.cs:23
Synthesis.Synchronization.SynchronizationEngine.get_ModelDictionary() in C:\Web\Synthesis\Source\Synthesis\Synchronization\SynchronizationEngine.cs:119
Synthesis.Synchronization.SynchronizationEngine.AreTemplatesSynchronized() in C:\Web\Synthesis\Source\Synthesis\Synchronization\SynchronizationEngine.cs:90
Synthesis.<>c__DisplayClass1_0.b__0(IProviderConfiguration configuration, TemplateGenerationMetadata metadata) in C:\Web\Synthesis\Source\Synthesis\SynthesisHelper.cs:36
Synthesis.SynthesisHelper.ExecMetadataWithAutoFriending(IEnumerable1 configurations, Action
2 processAction) in C:\Web\Synthesis\Source\Synthesis\SynthesisHelper.cs:63`
I set Media.AlwaysIncludeServerUrl to true in the Web.config and the images that rely on synthesis now 404.
They look like this below. Note the extra / at the beginning.
<img src="/http://www.lifesize.com/~/media/Images/New%20Images/Home/billboard.ashx">
Synthesis tries to prevent this behavior by checking AlwaysIncludeServerUrl, but we have that set to false because we only want the full URL for media items.
@JeremyClifton is working on a fix now and will reference this ticket in his pull request.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.