'Export to .net' not including properties on inherited tabs.
When trying to access a property on my doc type using Linq2Umbraco, I noticed that some of the properties were missing.
Sad times.
On investigating, I noticed that all the properties that were missing were on the same 'inherited' tab (from it's parent doc type). I moved the properties to a new temporary tab just to see if it made a difference and sure enough, they all exported fine.
My sneaky suspicion is that this is somewhat related to any work that went on regarding the following post:
Yes seeing the exact same issue in v.4.7, issue occurs with our without using the autoexport2dotnet (http://our.umbraco.org/projects/developer-tools/autoexport2dotnet) - so seems an issue in the core export logic.
Place a property of any type in the Generic tab and it always exports, move it to a tab inherited from the parent docType and it's excluded from the export.
This is caused by what seems like a bug in the umbraco.presentation project, in \umbraco\presentation\umbraco\dialogs\ExportCode.aspx.cs in the GenerateProperties method.
private object GenerateProperties(DocumentType dt) { var sb = new StringBuilder();
foreach (var pt in dt.getVirtualTabs.Where(x => x.ContentType == dt.Id).SelectMany(x => x.GetPropertyTypes(dt.Id, true)) .Concat(dt.PropertyTypes.Where(x => x.ContentTypeId == dt.Id /* don't limit this to generic tab! && x.TabId == 0*/)) ) { //...loops and writes properties here
In the above the bit to remove is the "x.TabId == 0" that I've commented out - this limits the properties rendered to the first tab (the generic properties).
I have only tested this quickly, but seems to work perfectly - I will update here if I find any issues - cheers!
PS. Please note that this method has changed between version 4.7.0 and 4.7.1 because of a separate issue - however for both version removing the "x.TabId == 0" solves this issue.
Further to the above, if you include abstractions (interfaces) in your export - the above amend also need to be done in the GenerateAbstractProperties method - so remove the TabID == 0 check, and add a Distinct() to the end.
'Export to .net' not including properties on inherited tabs.
When trying to access a property on my doc type using Linq2Umbraco, I noticed that some of the properties were missing.
Sad times.
On investigating, I noticed that all the properties that were missing were on the same 'inherited' tab (from it's parent doc type). I moved the properties to a new temporary tab just to see if it made a difference and sure enough, they all exported fine.
My sneaky suspicion is that this is somewhat related to any work that went on regarding the following post:
http://our.umbraco.org/forum/core/41-feedback/11619-LINQ-2-Umbraco-expected-export-behavior
Just wanted to see what people's opinions were and as to whether it's worth investigating a fix.
Thanks,
Rich
Rich,
I have been using http://our.umbraco.org/projects/developer-tools/autoexport2dotnet and have had no issues with inherited properties
Regards
Ismail
Yes seeing the exact same issue in v.4.7, issue occurs with our without using the autoexport2dotnet (http://our.umbraco.org/projects/developer-tools/autoexport2dotnet) - so seems an issue in the core export logic.
Place a property of any type in the Generic tab and it always exports, move it to a tab inherited from the parent docType and it's excluded from the export.
This is caused by what seems like a bug in the umbraco.presentation project, in \umbraco\presentation\umbraco\dialogs\ExportCode.aspx.cs in the GenerateProperties method.
In the above the bit to remove is the "x.TabId == 0" that I've commented out - this limits the properties rendered to the first tab (the generic properties).
I have only tested this quickly, but seems to work perfectly - I will update here if I find any issues - cheers!
PS. Please note that this method has changed between version 4.7.0 and 4.7.1 because of a separate issue - however for both version removing the "x.TabId == 0" solves this issue.
Hi Thomas,
Thanks for sharing the fix. I think you should also post this on Codeplex so one of the devs might see it and update it in the core as well :)
-Tom
Good point - that's here if anyone wants to vote: http://umbraco.codeplex.com/workitem/30419
Slight amend - need a distinct on the end, otherwise anything actually sitting in the "generic properties" tab gets duplicated:
Further to the above, if you include abstractions (interfaces) in your export - the above amend also need to be done in the GenerateAbstractProperties method - so remove the TabID == 0 check, and add a Distinct() to the end.
is working on a reply...