Compare commits

..

128 Commits

Author SHA1 Message Date
Mads Rasmussen 244ee646b9 Revert "update content when changing variation"
This reverts commit b487436d93.
2016-04-07 12:45:33 +02:00
Mads Rasmussen b487436d93 update content when changing variation 2016-04-07 12:38:05 +02:00
Mads Rasmussen 321b1a3964 disable autocomplete on editor name input 2016-04-07 11:17:05 +02:00
Mads Rasmussen f6b1971243 disable name input for a marketing variation 2016-04-07 11:05:21 +02:00
Simon Busborg ab1e412b4b Active in quickswitcher 2016-04-07 10:51:39 +02:00
Mads Rasmussen 2c866e8326 add spanish 2016-04-07 10:24:52 +02:00
Mads Rasmussen 433563c10b select first variation 2016-04-06 20:03:49 +02:00
Mads Rasmussen 95b91cb55f a bit fine tuning of selected variation and language 2016-04-06 19:29:29 +02:00
Mads Rasmussen d070b869a3 fix error in css 2016-04-06 16:09:26 +02:00
Mads Rasmussen 82bcb8bb8a Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-04-06 16:07:49 +02:00
Mads Rasmussen 8cbd0281aa set limit on apps 2016-04-06 16:07:12 +02:00
Simon Busborg 148067f119 apps 2016-04-06 16:01:16 +02:00
Mads Rasmussen 9d79577833 add activity app 2016-04-06 15:05:16 +02:00
Simon Busborg c24918aeb7 standard width on apps 2016-04-06 14:15:10 +02:00
Simon Busborg f7a814714c even spacing between apps 2016-04-06 11:36:34 +02:00
Simon Busborg 3200a7fd1a Splitview close 2016-04-06 11:23:38 +02:00
Mads Rasmussen 7983aedf53 make tabs to apps 2016-04-06 11:22:18 +02:00
Mads Rasmussen c31efa3f54 only show variations for active language + add sortable on variations 2016-04-05 15:16:55 +02:00
Simon Busborg c98a98dd71 Tabs 2016-04-05 15:07:35 +02:00
Mads Rasmussen ee3965521d bring back old tabs markup to enable active state 2016-04-05 14:34:57 +02:00
Mads Rasmussen 3d90c0d3d7 add segments to create variation + fix edit variation 2016-04-05 12:31:00 +02:00
Mads Rasmussen bc60aa1688 remove analytics from content plugins 2016-04-05 11:46:08 +02:00
Mads Rasmussen 5c90043298 hide the split view divider when there is no split view open 2016-04-05 11:44:16 +02:00
Mads Rasmussen 0f784151cb close split view on route change 2016-04-05 09:47:58 +02:00
Mads Rasmussen 681512da8c Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-04-04 19:04:53 +02:00
Mads Rasmussen b17770d6c7 fake split views 2016-04-04 19:04:36 +02:00
Simon Busborg 745b536f63 Fixed divider 2016-04-04 12:55:08 +02:00
Mads Rasmussen 738289cd78 comment out sync switcher and property overlay 2016-04-01 11:19:13 +02:00
Simon Busborg 77d30e8484 fixed colors 2016-03-30 15:02:53 +02:00
Simon Busborg 347fb3a90d demoed version of splitview (not pretty) 2016-03-30 12:24:01 +02:00
Mads Rasmussen 39bdc1bc78 handle 1sites with 1 language 2016-03-30 09:04:26 +02:00
Simon Busborg a3dcdb159b Removed tags, added tags checkboxes, styling in general for variations 2016-03-29 15:38:50 +02:00
Simon Busborg 9656659ecd overview 2016-03-29 13:46:11 +02:00
Mads Rasmussen d679a4e697 make it possible to fake variation content 2016-03-29 12:18:47 +02:00
Mads Rasmussen c81a034c69 only show variations toggle if there are any variations 2016-03-23 14:23:02 +01:00
Mads Rasmussen a519d38b54 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-23 14:13:10 +01:00
Mads Rasmussen cf4c09f41f When click on item in variation quick switcher - change context in header 2016-03-23 14:12:57 +01:00
Simon Busborg bd3096c3ec changed quick toggler 2016-03-23 13:49:07 +01:00
Simon Busborg 1bbf104b9f variations overview 2016-03-23 13:41:26 +01:00
Mads Rasmussen 4f1e44d42e get variations from helper service so they are in sync 2016-03-23 13:39:26 +01:00
Simon Busborg fa68a9472b quickswitcher update 2016-03-23 11:54:54 +01:00
Mads Rasmussen efb2b744fc Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-23 11:52:26 +01:00
Mads Rasmussen 9018c4ef79 add functionality to create, edit and delete variations - missing styling + segments 2016-03-23 11:52:04 +01:00
Simon Busborg dfce0aa0cb changed width of container 2016-03-23 08:59:52 +01:00
Mads Rasmussen 131c9a6fe1 move description inline 2016-03-22 16:24:18 +01:00
Mads Rasmussen 555589ef3b change colour on tags + bring back create variation link 2016-03-22 15:10:46 +01:00
Mads Rasmussen b099d35981 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/less/components/umb-variations.less
#	src/Umbraco.Web.UI.Client/src/views/components/umb-variations.html
2016-03-22 14:24:03 +01:00
Mads Rasmussen e3bc3091f7 add dynamic data to variations overview + clean up UI + add segments to variations overview 2016-03-22 14:17:20 +01:00
Simon Busborg 320ed93b14 active quick switcher 2016-03-22 13:50:39 +01:00
Simon Busborg c71ce7ef2a changed lang options 2016-03-22 10:59:12 +01:00
Mads Rasmussen c0ea46c9f1 split languages and variations in dropdown. Show selected in header 2016-03-22 10:55:33 +01:00
Mads Rasmussen 533443fd25 remove sidebar on variations 2016-03-22 10:47:00 +01:00
Simon Busborg e76658373f Added lang groups for variations 2016-03-22 10:13:05 +01:00
Mads Rasmussen a77330a592 add a bit a variations toggle styling 2016-03-21 10:39:48 +01:00
Mads Rasmussen 2f5e9ee8c4 change sync off label + smaller font size 2016-03-21 10:01:36 +01:00
Mads Rasmussen f252590a1c Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-18 14:40:23 +01:00
Mads Rasmussen fa4bdac78a style editor overlay label 2016-03-18 14:39:18 +01:00
Simon Busborg e268945077 fixed animate bug 2016-03-18 14:38:04 +01:00
Simon Busborg b428fb2211 fixed search / scrollable area 2016-03-18 14:26:24 +01:00
Mads Rasmussen bfc098e5e0 make change variation work work editor view 2016-03-18 14:09:07 +01:00
Simon Busborg d9b58e80fe added search to variations 2016-03-18 12:40:16 +01:00
Simon Busborg a7a860bbcd fixed dropdown 2016-03-18 12:03:05 +01:00
Mads Rasmussen fa277a4a5d fix styling on dropdown 2016-03-18 11:58:57 +01:00
Mads Rasmussen 7e1df76db3 move dropdown logic 2016-03-18 11:26:46 +01:00
Simon Busborg 9c33e292ae moved component to label 2016-03-18 11:13:49 +01:00
Mads Rasmussen 75edd645c6 add basic functionality to edit content and change which variation to sync content from 2016-03-17 21:31:09 +01:00
Mads Rasmussen 6adfdbf7dd clear variations when a new master i set 2016-03-17 20:30:29 +01:00
Mads Rasmussen 5453d86a46 make sidebar title a little smaller 2016-03-17 20:09:58 +01:00
Mads Rasmussen 6d4146b9c6 add wrappers and title to sidebar 2016-03-17 20:07:57 +01:00
Simon Busborg a93d98933f fixed z-index on buttons 2016-03-17 15:20:34 +01:00
Mads Rasmussen cf28c0ca5e change text and icon on sync toggle 2016-03-17 15:12:56 +01:00
Mads Rasmussen 435434b859 position toggle top 0 and right 0 2016-03-17 15:10:07 +01:00
Mads Rasmussen e93b057a5f make sync button a bit smaller 2016-03-17 15:02:38 +01:00
Simon Busborg e8d167faf0 added get content 2016-03-17 14:42:26 +01:00
Mads Rasmussen ab1322f789 started on dropdown 2016-03-17 12:39:40 +01:00
Simon Busborg 36abb83ff2 moved psuedo element to the property editor markup 2016-03-17 11:54:01 +01:00
Simon Busborg 0d62e62fda changed inactive state 2016-03-17 11:41:38 +01:00
Simon Busborg d25a01d9c9 added overlay to variation picker 2016-03-17 11:22:52 +01:00
Simon Busborg 1da55e4dde Fixed subview editor header 2016-03-17 10:46:08 +01:00
Simon Busborg c346ec1282 search width 2016-03-14 11:06:03 +01:00
Simon Busborg 556d4b4c11 search 2016-03-11 14:07:05 +01:00
Mads Rasmussen 7d0d58f7c2 fix notifications width 2016-03-11 13:53:50 +01:00
Mads Rasmussen a0618f401f Merge remote-tracking branch 'origin/temp-maurice' into temp-maurice 2016-03-11 13:19:48 +01:00
Mads Rasmussen 34645460fb Set position relative to contain absolute elements 2016-03-11 13:19:15 +01:00
Simon Busborg 43b534c3b1 tabs activity 2016-03-11 10:57:44 +01:00
Mads Rasmussen bc29b2e235 copy search functionality to top bar 2016-03-11 10:52:45 +01:00
Simon Busborg d6c226d41a Added navigation to sidebars 2016-03-10 15:29:41 +01:00
Simon Busborg 14d8b634b5 Acitvity feed 2016-03-10 12:45:08 +01:00
Mads Rasmussen c4e41c1df6 add a content wrapper to add padding 2016-03-10 12:20:46 +01:00
Mads Rasmussen 788efeb098 remove horizontal scrollbar in media folders 2016-03-10 11:57:00 +01:00
Mads Rasmussen 71916af49c hide generic properties tab content 2016-03-10 11:56:31 +01:00
Mads Rasmussen 55e62c01e4 hide tab instead of removing it.. now we can save again 2016-03-10 11:43:53 +01:00
Mads Rasmussen fa8dc5ace4 remove console.logs 2016-03-10 11:22:08 +01:00
Simon Busborg 671d99f455 changed menu state 2016-03-10 11:09:51 +01:00
Mads Rasmussen d681a84800 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-10 10:59:07 +01:00
Mads Rasmussen 440e2a7d56 bring back dashboards 2016-03-10 10:58:45 +01:00
Simon Busborg 2f8ec7bd29 Added more and added sidebar navigation status 2016-03-10 10:58:07 +01:00
Simon Busborg 5105cf890d displaying apps center 2016-03-10 10:04:32 +01:00
Mads Rasmussen 88a0f21328 align sub view header content left and right 2016-03-10 09:58:52 +01:00
Mads Rasmussen cd1ea78825 contain absolute positioned elements inside content 2016-03-10 09:33:57 +01:00
Simon Busborg ca4ff98c5f navigation fluf 2016-03-10 09:18:26 +01:00
Mads Rasmussen 339e1dc94e WIP bring in variation ideas + a couple of placeholder subviews 2016-03-10 09:16:37 +01:00
Mads Rasmussen a84c6e9dff remove generic properties tab 2016-03-10 09:15:29 +01:00
Simon Busborg ba927d1962 fixed tree navigation 2016-03-09 20:40:34 +01:00
Simon Busborg ee30f10357 Dropdown 2016-03-09 20:21:14 +01:00
Simon Busborg 478fe51651 Added tree toggler 2016-03-09 15:21:43 +01:00
Mads Rasmussen 5694beafef add subviews to content 2016-03-08 14:49:04 +01:00
Mads Rasmussen 2a1e9e30ae add generic properties icon 2016-03-07 10:01:33 +01:00
Mads Rasmussen ef5bf29b07 remove background color on footer - wireframe style 2016-03-07 09:58:42 +01:00
Mads Rasmussen 7b521e6857 um tree nav - set overflow to auto 2016-03-07 09:51:35 +01:00
Mads Rasmussen 4135e30834 add tabs to media 2016-03-05 14:03:16 +01:00
Mads Rasmussen 2b1bf0b966 add scroll to tree 2016-03-04 18:42:06 +01:00
Mads Rasmussen 6bc2ce19f5 hide search in tree 2016-03-04 18:13:21 +01:00
Mads Rasmussen 67efc1906a add editor toolbar directive - move tabs outside header for content section 2016-03-04 18:12:53 +01:00
Mads Rasmussen 8b62d09e64 remove background from editor header - wireframe look 2016-03-04 18:09:34 +01:00
Mads Rasmussen 5c6bbfb423 remove background + add border to navigation bar - wireframe look 2016-03-04 18:09:04 +01:00
Mads Rasmussen 97ff32245d fix navigation height 2016-03-04 14:43:56 +01:00
Simon Busborg b7549ad644 Fixed second header 🌮 2016-03-04 11:31:56 +01:00
Mads Rasmussen 802fe45614 Merge branch 'temp-maurice' of https://github.com/umbraco/Umbraco-CMS into temp-maurice 2016-03-04 11:05:06 +01:00
Mads Rasmussen 253a4520b0 tighten up tree a bit 2016-03-04 11:04:41 +01:00
Simon Busborg b6877dc4ce fixed header size 2016-03-04 11:03:50 +01:00
Simon Busborg 27a031ea12 Updated recess – fixed content scroll 2016-03-04 10:59:19 +01:00
Mads Rasmussen 0e2212bd40 less padding and smaller font size on top navigation 2016-03-04 10:34:18 +01:00
Simon Busborg 8ee414793f flex - content 2016-03-04 10:26:33 +01:00
Simon Busborg 1dddc06ae7 added tree 🌳 2016-03-03 16:12:07 +01:00
Simon Busborg 3d253b79e4 Added very slick navigation 🔥 2016-03-03 14:26:37 +01:00
Mads Rasmussen e7542bc455 add functionality to top bar navigation - needs styling 2016-03-03 12:56:38 +01:00
Simon Busborg 43ab5a8e2e Nuked interface 2016-03-03 10:38:01 +01:00
912 changed files with 24783 additions and 32285 deletions
+134 -143
View File
@@ -1,143 +1,134 @@
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
.DS_Store
._.DS_Store
[Bb]in
[Db]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
_NCrunch_*/
*.ncrunchsolution
*.ncrunchsolution.user
*.ncrunchproject
*.crunchsolution.cache
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.suo
[sS]ource
[sS]andbox
umbraco.config
*.vs10x
App_Data/TEMP/*
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
[Uu]mbraco/[Pp]resentation/[Ss]cripts/*
[Uu]mbraco/[Pp]resentation/[Ff]onts/*
[Uu]mbraco/[Pp]resentation/[Cc]ss/*
src/Umbraco.Web.UI/[Cc]ss/*
src/Umbraco.Web.UI/App_Code/*
src/Umbraco.Web.UI/App_Data/*
src/Umbraco.Tests/App_Data/*
src/Umbraco.Web.UI/[Mm]edia/*
src/Umbraco.Web.UI/[Mm]aster[Pp]ages/*
src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/*
!src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/[Ww]eb.[Cc]onfig
src/Umbraco.Web.UI/[Xx]slt/*
src/Umbraco.Web.UI/[Ii]mages/*
src/Umbraco.Web.UI/[Ss]cripts/*
src/Umbraco.Web.UI/Web.*.config.transformed
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
_BuildOutput/*
*.ncrunchsolution
build/UmbracoCms.AllBinaries*zip
build/UmbracoCms.WebPI*zip
build/UmbracoCms*zip
build/UmbracoExamine.PDF*zip
build/*.nupkg
src/Umbraco.Tests/config/applications.config
src/Umbraco.Tests/config/trees.config
src/Umbraco.Web.UI/web.config
src/Umbraco.Web.UI/Config/ClientDependency.config
*.orig
src/Umbraco.Tests/config/404handlers.config
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config
src/Umbraco.Web.UI/[Vv]iews/*
src/packages/
src/packages/repositories.config
src/Umbraco.Web.UI/[Ww]eb.config
*.transformed
webpihash.txt
node_modules
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.panel.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.palettes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.front.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.config.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
src/Umbraco.Web.UI.Client/[Bb]uild/*
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
build/_BuildOutput/
src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css
tools/NDepend/
src/Umbraco.Web.UI/App_Plugins/*
src/*.psess
src/*.vspx
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js.*
NDependOut/*
*.ndproj
QueryResult.htm
*.ndproj
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
src/Umbraco.Web.UI/[Cc]onfig/appSettings.config
src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config
src/Umbraco.Web.UI/umbraco/plugins/*
src/Umbraco.Web.UI/umbraco/js/init.js
build/ApiDocs/*
build/ApiDocs/Output/*
src/Umbraco.Web.UI.Client/bower_components/*
/src/Umbraco.Web.UI/Umbraco/preview
#Ignore Rule for output of generated documentation files from Grunt docserve
src/Umbraco.Web.UI.Client/docs/api
src/*.boltdata/
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.loader.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.palettes.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.panel.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.config.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.front.js
src/umbraco.sln.ide/*
build/UmbracoCms.*/
src/.vs/
src/Umbraco.Web.UI/umbraco/js/install.loader.js
src/Umbraco.Tests/media
tools/docfx/*
apidocs/_site/*
apidocs/api/*
build/docs.zip
build/ui-docs.zip
build/csharp-docs.zip
build/msbuild.log
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
.DS_Store
._.DS_Store
[Bb]in
[Db]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
_NCrunch_*/
*.ncrunchsolution
*.ncrunchsolution.user
*.ncrunchproject
*.crunchsolution.cache
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.suo
[sS]ource
[sS]andbox
umbraco.config
*.vs10x
App_Data/TEMP/*
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
[Uu]mbraco/[Pp]resentation/[Ss]cripts/*
[Uu]mbraco/[Pp]resentation/[Ff]onts/*
[Uu]mbraco/[Pp]resentation/[Cc]ss/*
src/Umbraco.Web.UI/[Cc]ss/*
src/Umbraco.Web.UI/App_Code/*
src/Umbraco.Web.UI/App_Data/*
src/Umbraco.Tests/App_Data/*
src/Umbraco.Web.UI/[Mm]edia/*
src/Umbraco.Web.UI/[Mm]aster[Pp]ages/*
src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/*
!src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/[Ww]eb.[Cc]onfig
src/Umbraco.Web.UI/[Xx]slt/*
src/Umbraco.Web.UI/[Ii]mages/*
src/Umbraco.Web.UI/[Ss]cripts/*
src/Umbraco.Web.UI/Web.*.config.transformed
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
_BuildOutput/*
*.ncrunchsolution
build/UmbracoCms.AllBinaries*zip
build/UmbracoCms.WebPI*zip
build/UmbracoCms*zip
build/UmbracoExamine.PDF*zip
build/*.nupkg
src/Umbraco.Tests/config/applications.config
src/Umbraco.Tests/config/trees.config
src/Umbraco.Web.UI/web.config
*.orig
src/Umbraco.Tests/config/404handlers.config
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config
src/Umbraco.Web.UI/[Vv]iews/*
src/packages/
src/packages/repositories.config
src/Umbraco.Web.UI/[Ww]eb.config
*.transformed
webpihash.txt
node_modules
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.panel.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.palettes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.front.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.config.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
src/Umbraco.Web.UI.Client/[Bb]uild/*
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
build/_BuildOutput/
src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css
tools/NDepend/
src/Umbraco.Web.UI/App_Plugins/*
src/*.psess
src/*.vspx
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js.*
NDependOut/*
*.ndproj
QueryResult.htm
*.ndproj
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
src/Umbraco.Web.UI/[Cc]onfig/appSettings.config
src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config
src/Umbraco.Web.UI/umbraco/plugins/*
src/Umbraco.Web.UI/umbraco/js/init.js
build/ApiDocs/*
build/ApiDocs/Output/*
src/Umbraco.Web.UI.Client/bower_components/*
/src/Umbraco.Web.UI/Umbraco/preview
#Ignore Rule for output of generated documentation files from Grunt docserve
src/Umbraco.Web.UI.Client/docs/api
src/*.boltdata/
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.loader.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.palettes.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.panel.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.config.js
/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.front.js
src/umbraco.sln.ide/*
build/UmbracoCms.*/
src/.vs/
src/Umbraco.Web.UI/umbraco/js/install.loader.js
+4 -6
View File
@@ -3,11 +3,9 @@ Umbraco CMS
Umbraco is a free open source Content Management System built on the ASP.NET platform.
## Building Umbraco from source ##
The easiest way to get started is to run `build/build.bat` which will build both the backoffice (also known as "Belle") and the Umbraco core. You can then easily start debugging from Visual Studio, or if you need to debug Belle you can run `grunt vs` in `src\Umbraco.Web.UI.Client`.
The easiest way to get started is to run `build/build.bat` which will build both the backoffice (also known as "Belle") and the Umbraco core. You can then easily start debugging from Visual Studio, or if you need to debug Belle you can run `grunt dev` in `src\Umbraco.Web.UI.Client`.
If you're interested in making changes to Belle without running Visual Studio make sure to read the [Belle ReadMe file](src/Umbraco.Web.UI.Client/README.md).
Note that you can always [download a nightly build](http://nightly.umbraco.org/?container=umbraco-750) so you don't have to build the code yourself.
If you're interested in making changes to Belle make sure to read the [Belle ReadMe file](src/Umbraco.Web.UI.Client/README.md). Note that you can always [download a nightly build](http://nightly.umbraco.org/umbraco%207.0.0/) so you don't have to build the code yourself.
## Watch a introduction video ##
@@ -15,11 +13,11 @@ Note that you can always [download a nightly build](http://nightly.umbraco.org/?
## Umbraco - the simple, flexible and friendly ASP.NET CMS ##
**More than 350,000 sites trust Umbraco**
**More than 177,000 sites trust Umbraco**
For the first time on the Microsoft platform, there is a free user and developer friendly CMS that makes it quick and easy to create websites - or a breeze to build complex web applications. Umbraco has award-winning integration capabilities and supports ASP.NET MVC or Web Forms, including User and Custom Controls, out of the box. It's a developer's dream and your users will love it too.
Used by more than 350,000 active websites including [http://daviscup.com](http://daviscup.com), [http://heinz.com](http://heinz.com), [http://peugeot.com](http://peugeot.com), [http://www.hersheys.com/](http://www.hersheys.com/) and **The Official ASP.NET and IIS.NET website from Microsoft** ([http://asp.net](http://asp.net) / [http://iis.net](http://iis.net)), you can be sure that the technology is proven, stable and scales.
Used by more than 177,000 active websites including [http://daviscup.com](http://daviscup.com), [http://heinz.com](http://heinz.com), [http://peugeot.com](http://peugeot.com), [http://www.hersheys.com/](http://www.hersheys.com/) and **The Official ASP.NET and IIS.NET website from Microsoft** ([http://asp.net](http://asp.net) / [http://iis.net](http://iis.net)), you can be sure that the technology is proven, stable and scales.
To view more examples, please visit [http://umbraco.com/why-umbraco/#caseStudies](http://umbraco.com/why-umbraco/#caseStudies)
-18
View File
@@ -1,18 +0,0 @@
apiRules:
- include:
uidRegex: ^Umbraco\.Core
- exclude:
uidRegex: ^umbraco\.Web\.org
- include:
uidRegex: ^Umbraco\.Web
- exclude:
hasAttribute:
uid: System.ComponentModel.EditorBrowsableAttribute
ctorArguments:
- System.ComponentModel.EditorBrowsableState.Never
- exclude:
uidRegex: ^umbraco\.
- exclude:
uidRegex: ^CookComputing\.
- exclude:
uidRegex: ^.*$
-75
View File
@@ -1,75 +0,0 @@
{
"metadata": [
{
"src": [
{
"files": [
"Umbraco.Core/Umbraco.Core.csproj",
"Umbraco.Web/Umbraco.Web.csproj"
],
"exclude": [
"**/obj/**",
"**/bin/**",
"_site/**"
],
"cwd": "../src"
}
],
"dest": "../apidocs/api",
"filter": "../apidocs/docfx.filter.yml"
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"overwrite": [
{
"files": [
"**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"globalMetadata": {
"_appTitle": "Umbraco c# Api docs",
"_enableSearch": true,
"_disableContribution": false
},
"dest": "_site",
"template": [
"default", "umbracotemplate"
]
}
}
-7
View File
@@ -1,7 +0,0 @@
# Umbraco c# API reference
## Quick Links:
### [Umbraco.Core](api/Umbraco.Core.html) docs
### [Umbraco.Web](api/Umbraco.Web.html) docs
-5
View File
@@ -1,5 +0,0 @@
- name: Umbraco.Core Documentation
href: https://our.umbraco.org/apidocs/csharp/api/Umbraco.Core.html
- name: Umbraco.Web Documentation
href: https://our.umbraco.org/apidocs/csharp/api/Umbraco.Web.html
@@ -1,257 +0,0 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
{{^_disableContribution}}
{{#sourceurl}}<a href="{{sourceurl}}" class="btn btn-primary pull-right mobile-hide">{{__global.viewSource}}</a>{{/sourceurl}}
{{/_disableContribution}}
<h1 id="{{id}}" data-uid="{{uid}}">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
{{#inheritance.0}}
<div class="inheritance">
<h5>{{__global.inheritance}}</h5>
{{#inheritance}}
<div class="level{{index}}">{{{specName.0.value}}}</div>
{{/inheritance}}
<div class="level{{item.level}}"><span class="xref">{{item.name.0.value}}</span></div>
</div>
{{/inheritance.0}}
<h6><strong>{{__global.namespace}}</strong>:{{namespace}}</h6>
<h6><strong>{{__global.assembly}}</strong>:{{assemblies.0}}.dll</h6>
<h5 id="{{id}}_syntax">{{__global.syntax}}</h5>
<div class="codewrapper">
<pre><code class="lang-{{_lang}} hljs">{{syntax.content.0.value}}</code></pre>
</div>
{{#syntax.parameters.0}}
<h5 class="parameters">{{__global.parameters}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.name}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
{{/syntax.parameters.0}}
{{#syntax.parameters}}
<tr>
<td>{{{type.specName.0.value}}}</td>
<td><em>{{{id}}}</em></td>
<td>{{{description}}}</td>
</tr>
{{/syntax.parameters}}
{{#syntax.parameters.0}}
</tbody>
</table>
{{/syntax.parameters.0}}
{{#syntax.return}}
<h5 class="returns">{{__global.returns}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{{type.specName.0.value}}}</td>
<td>{{{description}}}</td>
</tr>
</tbody>
</table>
{{/syntax.return}}
{{#syntax.typeParameters.0}}
<h5 class="typeParameters">{{__global.typeParameters}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.name}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
{{/syntax.typeParameters.0}}
{{#syntax.typeParameters}}
<tr>
<td><em>{{{id}}}</em></td>
<td>{{{description}}}</td>
</tr>
{{/syntax.typeParameters}}
{{#syntax.typeParameters.0}}
</tbody>
</table>
{{/syntax.typeParameters.0}}
{{#remarks}}
<h5 id="{{id}}_remarks"><strong>{{__global.remarks}}</strong></h5>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{/remarks}}
{{#example.0}}
<h5 id="{{id}}_examples"><strong>{{__global.examples}}</strong></h5>
{{/example.0}}
{{#example}}
{{{.}}}
{{/example}}
{{#children}}
<h3 id="{{id}}">{{>partials/classSubtitle}}</h3>
{{#children}}
{{^_disableContribution}}
{{#sourceurl}}
<span class="small pull-right mobile-hide">
<a href="{{sourceurl}}">{{__global.viewSource}}</a>
</span>{{/sourceurl}}
{{/_disableContribution}}
<h4 id="{{id}}" data-uid="{{uid}}">{{name.0.value}}</h4>
<div class="markdown level1 summary">{{{summary}}}</div>
<div class="markdown level1 conceptual">{{{conceptual}}}</div>
<h5 class="decalaration">{{__global.declaration}}</h5>
{{#syntax}}
<div class="codewrapper">
<pre><code class="lang-{{_lang}} hljs">{{syntax.content.0.value}}</code></pre>
</div>
{{#parameters.0}}
<h5 class="parameters">{{__global.parameters}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.name}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
{{/parameters.0}}
{{#parameters}}
<tr>
<td>{{{type.specName.0.value}}}</td>
<td><em>{{{id}}}</em></td>
<td>{{{description}}}</td>
</tr>
{{/parameters}}
{{#parameters.0}}
</tbody>
</table>
{{/parameters.0}}
{{#return}}
<h5 class="returns">{{__global.returns}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{{type.specName.0.value}}}</td>
<td>{{{description}}}</td>
</tr>
</tbody>
</table>
{{/return}}
{{#typeParameters.0}}
<h5 class="typeParameters">{{__global.typeParameters}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.name}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
{{/typeParameters.0}}
{{#typeParameters}}
<tr>
<td><em>{{{id}}}</em></td>
<td>{{{description}}}</td>
</tr>
{{/typeParameters}}
{{#typeParameters.0}}
</tbody>
</table>
{{/typeParameters.0}}
{{#fieldValue}}
<h5 class="fieldValue">{{__global.fieldValue}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{{type.specName.0.value}}}</td>
<td>{{{description}}}</td>
</tr>
</tbody>
</table>
{{/fieldValue}}
{{#propertyValue}}
<h5 class="propertyValue">{{__global.propertyValue}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{{type.specName.0.value}}}</td>
<td>{{{description}}}</td>
</tr>
</tbody>
</table>
{{/propertyValue}}
{{#eventType}}
<h5 class="eventType">{{__global.eventType}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.description}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{{type.specName.0.value}}}</td>
<td>{{{description}}}</td>
</tr>
</tbody>
</table>
{{/eventType}}
{{/syntax}}
{{#remarks}}
<h5 id="{{id}}_remarks">{{__global.remarks}}</h5>
<div class="markdown level1 remarks">{{{remarks}}}</div>
{{/remarks}}
{{#example.0}}
<h5 id="{{id}}_examples">{{__global.examples}}</h5>
{{/example.0}}
{{#example}}
{{{.}}}
{{/example}}
{{#exceptions.0}}
<h5 class="exceptions">{{__global.exceptions}}</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>{{__global.type}}</th>
<th>{{__global.condition}}</th>
</tr>
</thead>
<tbody>
{{/exceptions.0}}
{{#exceptions}}
<tr>
<td>{{{type.specName.0.value}}}</td>
<td>{{{description}}}</td>
</tr>
{{/exceptions}}
{{#exceptions.0}}
</tbody>
</table>
{{/exceptions.0}}
{{/children}}
{{/children}}
@@ -1,13 +0,0 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Copyright © 2016 Umbraco<br>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
@@ -1,18 +0,0 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
<meta name="generator" content="docfx {{_docfxVersion}}">
{{#_description}}<meta name="description" content="{{_description}}">{{/_description}}
<link rel="icon" type="image/png" href="https://our.umbraco.org/assets/images/app-icons/favicon.png">
<link rel="stylesheet" href="{{_rel}}styles/docfx.vendor.css">
<link rel="stylesheet" href="{{_rel}}styles/docfx.css">
<link rel="stylesheet" href="{{_rel}}styles/main.css">
<meta property="docfx:navrel" content="{{_navRel}}">
<meta property="docfx:tocrel" content="{{_tocRel}}">
{{#_enableSearch}}<meta property="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
</head>
@@ -1,18 +0,0 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
{{^_disableContribution}}
{{#sourceurl}}
<a href="{{sourceurl}}" class="btn btn-primary pull-right mobile-hide">{{__global.viewSource}}</a>
{{/sourceurl}}
{{/_disableContribution}}
<h1 id="{{id}}" data-uid="{{uid}}">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{#children}}
<h3 id="{{id}}">{{>partials/namespaceSubtitle}}</h3>
{{#children}}
<h4>{{{specName.0.value}}}</h4>
<section>{{{summary}}}</section>
{{/children}}
{{/children}}
@@ -1,22 +0,0 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/" alt="Our Umbraco"></a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
@@ -1,101 +0,0 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
{{^_disableContribution}}
{{#sourceurl}}<a href="{{sourceurl}}" class="btn btn-primary pull-right mobile-hide">View Source</a>{{/sourceurl}}
{{/_disableContribution}}
<h1 id="{{htmlId}}" data-uid="{{uid}}" class="text-capitalize">{{name}}</h1>
{{#summary}}
<div class="markdown level0 summary">{{{summary}}}</div>
{{/summary}}
{{#description}}
<div class="markdown level0 description">{{{description}}}</div>
{{/description}}
{{#conceptual}}
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
{{/conceptual}}
{{#children}}
{{^_disableContribution}}
{{#sourceurl}}
<span class="small pull-right mobile-hide">
<a href="{{sourceurl}}">View Source</a>
</span>{{/sourceurl}}
{{/_disableContribution}}
<h3 id="{{htmlId}}" data-uid="{{uid}}" class="text-capitalize">{{operationId}}</h3>
{{#summary}}
<div class="markdown level1 summary">{{{summary}}}</div>
{{/summary}}
{{#description}}
<div class="markdown level1 description">{{{description}}}</div>
{{/description}}
{{#conceptual}}
<div class="markdown level1 conceptual">{{{conceptual}}}</div>
{{/conceptual}}
<h5>Request</h5>
<div class="codewrapper">
<pre><code class="lang-restApi hljs">{{operation}} {{path}}</code></pre>
</div>
{{#parameters.0}}
<h5>Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Value</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{{/parameters.0}}
{{#parameters}}
<tr>
<td><em>{{#required}}*{{/required}}{{name}}</em></td>
<td>{{type}}</td>
<td>{{default}}</td>
<td>{{{description}}}</td>
</tr>
{{/parameters}}
{{#parameters.0}}
</tbody>
</table>
{{/parameters.0}}
{{#responses.0}}
<div class="responses">
<h5>Responses</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Status Code</th>
<th>Description</th>
<th>Samples</th>
</tr>
</thead>
<tbody>
{{/responses.0}}
{{#responses}}
<tr>
<td><span class="status">{{statusCode}}</span></td>
<td>{{{description}}}</td>
<td class="sample-response">
{{#examples}}
<div class="mime-type">
<i>Mime type: </i><span class="mime">{{mimeType}}</span>
</div>
<pre class="response-content"><code class="lang-js json hljs">{{content}}</code></pre>
{{/examples}}
</td>
</tr>
{{/responses}}
{{#responses.0}}
</tbody>
</table>
</div>
{{/responses.0}}
{{#footer}}
<div class="markdown level1 api-footer">{{{footer}}}</div>
{{/footer}}
{{/children}}
{{#footer}}
<div class="markdown level0 api-footer">{{{footer}}}</div>
{{/footer}}
-73
View File
@@ -1,73 +0,0 @@
body {
color: rgba(0,0,0,.8);
}
.navbar-inverse {
background: #a3db78;
}
.navbar-inverse .navbar-nav>li>a, .navbar-inverse .navbar-text {
color: rgba(0,0,0,.8);
}
.navbar-inverse {
border-color: transparent;
}
.sidetoc {
background-color: #f5fbf1;
}
body .toc {
background-color: #f5fbf1;
}
.sidefilter {
background-color: #daf0c9;
}
.subnav {
background-color: #f5fbf1;
}
.navbar-inverse .navbar-nav>.active>a {
color: rgba(0,0,0,.8);
background-color: #daf0c9;
}
.navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover {
color: rgba(0,0,0,.8);
background-color: #daf0c9;
}
.btn-primary {
color: rgba(0,0,0,.8);
background-color: #fff;
border-color: rgba(0,0,0,.8);
}
.btn-primary:hover {
background-color: #daf0c9;
color: rgba(0,0,0,.8);
border-color: rgba(0,0,0,.8);
}
.toc .nav > li > a {
color: rgba(0,0,0,.8);
}
button, a {
color: #f36f21;
}
button:hover,
button:focus,
a:hover,
a:focus {
color: #143653;
text-decoration: none;
}
.navbar-header .navbar-brand {
background: url(https://our.umbraco.org/assets/images/logo.svg) left center no-repeat;
background-size: 40px auto;
width:50px;
}
.toc .nav > li.active > a {
color: #f36f21;
}
-57
View File
@@ -1,57 +0,0 @@
version: '{build}'
shallow_clone: true
build_script:
- cmd: >-
cd build
SET "release="
FOR /F "skip=1 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED release SET "release=%%i"
SET nuGetFolder=C:\Users\appveyor\.nuget\packages
..\src\.nuget\NuGet.exe sources Add -Name MyGetUmbracoCore -Source https://www.myget.org/F/umbracocore/api/v2/ >NUL
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Web.UI\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet
IF EXIST ..\src\umbraco.businesslogic\packages.config ..\src\.nuget\NuGet.exe install ..\src\umbraco.businesslogic\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Core\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet
ECHO Building Release %release% build%APPVEYOR_BUILD_NUMBER%
SET PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
SET MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe"
XCOPY "..\src\Umbraco.Tests\unit-test-log4net.CI.config" "..\src\Umbraco.Tests\unit-test-log4net.config" /Y
%MSBUILD% "..\src\Umbraco.Tests\Umbraco.Tests.csproj" /consoleloggerparameters:Summary;ErrorsOnly
build.bat nopause %release% build%APPVEYOR_BUILD_NUMBER%
ECHO %PATH%
test:
assemblies: src\Umbraco.Tests\bin\Debug\Umbraco.Tests.dll
artifacts:
- path: build\UmbracoCms.*
name: UmbracoFiles
- path: build\msbuild.log
name: BuildLog
deploy:
- provider: AzureBlob
storage_account_name: umbraconightlies
storage_access_key:
secure: bmEMml2SF7QLHULiePa/a01XOeIa2SxJeXuaZ+1R27b+Vb2nNUQVYiPlUyF2cZAFSHI/zO/LekRsVU1rTescGhJjF7SSjKybymI3p+F/OWpwqiu2WfFee1ofXBFx8QHw
container: umbraco-750
artifact: UmbracoFiles
on:
branch: dev-v7
notifications:
- provider: Slack
auth_token:
secure: v2csJi2V5ghR0rPdODK8GJdOGNCA+XaK84iQ9MdPOClqB+VU+40ybdKp6gPirGSH
channel: '#build-umbraco-core'
on_build_success: false
on_build_failure: true
on_build_status_changed: false
+170
View File
@@ -0,0 +1,170 @@
/* File : TOC.css
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 09/07/2007
//
// Stylesheet for the table of content
*/
*
{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
body
{
font-family: Segoe UI, Arial, Verdana, Helvetica, sans-serif;
font-size: 0.9em;
background-color: white;
color: White;
overflow: hidden;
}
input
{
padding:5px;
margin: 3px 0px 3px 0px
}
img
{
border: 0;
margin-left: 5px;
margin-right: 2px;
}
img.TreeNodeImg
{
cursor: pointer;
}
img.TOCLink
{
cursor: pointer;
margin-left: 0;
margin-right: 0;
}
a.SelectedNode, a.UnselectedNode
{
color: #333;
text-decoration: none;
padding: 1px 3px 1px 3px;
white-space: nowrap;
}
a.SelectedNode
{
background-color: #ffffff;
border: solid 1px #999999;
padding: 0px 2px 0px 2px;
}
a.UnselectedNode:hover, a.SelectedNode:hover
{
background-color: #cccccc;
border: solid 1px #999999;
padding: 0px 2px 0px 2px;
}
.Visible
{
display: block;
margin-left: 2em;
}
.Hidden
{
display: none;
}
.Tree
{
background-color: #fff;
color: #333;
width: 300px;
overflow: auto;
}
.TreeNode, .TreeItem
{
white-space: nowrap;
margin: 2px 2px 2px 2px;
}
.TOCDiv
{
position: relative;
float: left;
width: 300px;
height: 100%;
}
.TOCSizer
{
clear: none;
float: left;
width: 10px;
height: 100%;
background-image: url("Splitter.gif");
background-position:center center;
background-repeat:no-repeat;
position: relative;
cursor: w-resize;
border-left: solid 1px #CCC;
}
.TopicContent
{
position: relative;
float: right;
background-color: white;
height: 100%;
}
.SearchOpts
{
padding: 5px 5px 10px 5px;
color: black;
width: 300px;
border-bottom: solid lightgrey 1px;
height: 110px !important;
}
.NavOpts
{
padding: 5px 5px 6px 5px;
color: black;
width: 300px;
border-bottom: solid lightgrey 1px;
}
.NavOpts img {
display:inline-block;
margin: 0px 5px 0px 5px;
}
.IndexOpts
{
padding: 5px 5px 6px 5px;
color: black;
width: 300px;
border-bottom: solid lightgrey 1px;
}
.IndexItem
{
white-space: nowrap;
margin: 2px 2px 2px 2px;
}
.IndexSubItem
{
white-space: nowrap;
margin: 2px 2px 2px 12px;
}
.PaddedText
{
margin: 10px 10px 10px 10px;
}
+172
View File
@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<!-- The configuration and platform will be used to determine which
assemblies to include from solution and project documentation
sources -->
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{cb4d85f1-7390-40ee-b41f-a724bb8fddea}</ProjectGuid>
<SHFBSchemaVersion>1.9.5.0</SHFBSchemaVersion>
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
Studio adds them anyway -->
<AssemblyName>Documentation</AssemblyName>
<RootNamespace>Documentation</RootNamespace>
<Name>Documentation</Name>
<!-- SHFB properties -->
<FrameworkVersion>.NET Framework 4.5</FrameworkVersion>
<OutputPath>.\Output\</OutputPath>
<HtmlHelpName>UmbracoClassLibrary</HtmlHelpName>
<Language>en-US</Language>
<BuildAssemblerVerbosity>OnlyErrors</BuildAssemblerVerbosity>
<BuildLogFile>csharp-api-docs.log</BuildLogFile>
<HelpFileFormat>Website</HelpFileFormat>
<IndentHtml>True</IndentHtml>
<KeepLogFile>False</KeepLogFile>
<DisableCodeBlockComponent>False</DisableCodeBlockComponent>
<CppCommentsFixup>False</CppCommentsFixup>
<CleanIntermediates>True</CleanIntermediates>
<SyntaxFilters>CSharp</SyntaxFilters>
<SdkLinkTarget>Blank</SdkLinkTarget>
<RootNamespaceContainer>False</RootNamespaceContainer>
<PresentationStyle>VS2010</PresentationStyle>
<Preliminary>False</Preliminary>
<NamingMethod>Guid</NamingMethod>
<HelpTitle>Umbraco .Net Class Library</HelpTitle>
<ContentPlacement>AboveNamespaces</ContentPlacement>
<VisibleItems>Attributes, InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected</VisibleItems>
<ComponentConfigurations />
<DocumentationSources>
<DocumentationSource sourceFile="..\..\src\Umbraco.Core\Umbraco.Core.csproj" />
<DocumentationSource sourceFile="..\..\src\Umbraco.Core\bin\Release\Umbraco.Core.xml" />
<DocumentationSource sourceFile="..\..\src\Umbraco.Web\Umbraco.Web.csproj" />
<DocumentationSource sourceFile="..\..\src\Umbraco.Web\bin\Release\umbraco.xml" /></DocumentationSources>
<WebsiteSdkLinkType>None</WebsiteSdkLinkType>
<HtmlSdkLinkType>None</HtmlSdkLinkType>
<IncludeFavorites>False</IncludeFavorites>
<BinaryTOC>True</BinaryTOC>
<MissingTags>Summary, AutoDocumentCtors, AutoDocumentDispose</MissingTags>
<TransformComponentArguments>
<Argument Key="logoFile" Value="" />
<Argument Key="logoHeight" Value="" />
<Argument Key="logoWidth" Value="" />
<Argument Key="logoAltText" Value="" />
<Argument Key="logoPlacement" Value="left" />
<Argument Key="logoAlignment" Value="left" />
</TransformComponentArguments>
<ApiFilter>
<Filter entryType="Namespace" fullName="CookComputing.Blogger" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="CookComputing.MetaWeblog" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="dashboardUtilities" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="presentation.umbraco.webservices" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco" isExposed="False" xmlns="">
<Filter entryType="Class" fullName="umbraco.content" filterName="content" isExposed="True" />
<Filter entryType="Delegate" fullName="umbraco.content.ContentCacheDatabaseLoadXmlStringEventHandler" filterName="content.ContentCacheDatabaseLoadXmlStringEventHandler" isExposed="False" />
<Filter entryType="Delegate" fullName="umbraco.content.ContentCacheLoadNodeEventHandler" filterName="content.ContentCacheLoadNodeEventHandler" isExposed="False" />
<Filter entryType="Delegate" fullName="umbraco.content.DocumentCacheEventHandler" filterName="content.DocumentCacheEventHandler" isExposed="False" />
<Filter entryType="Delegate" fullName="umbraco.content.RefreshContentEventHandler" filterName="content.RefreshContentEventHandler" isExposed="False" />
<Filter entryType="Class" fullName="umbraco.ContentExtensions" filterName="ContentExtensions" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.ContentTypeExtensions" filterName="ContentTypeExtensions" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.item" filterName="item" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.library" filterName="library" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.macro" filterName="macro" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.MacroCacheContent" filterName="MacroCacheContent" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.MacroRenderingEventArgs" filterName="MacroRenderingEventArgs" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.MediaExtensions" filterName="MediaExtensions" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.MemberExtensions" filterName="MemberExtensions" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.page" filterName="page" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.PreValueExtensions" filterName="PreValueExtensions" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.RelationTypeExtensions" filterName="RelationTypeExtensions" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.template" filterName="template" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.UmbracoObjectTypeExtensions" filterName="UmbracoObjectTypeExtensions" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.uQuery" filterName="uQuery" isExposed="True" />
<Filter entryType="Interface" fullName="umbraco.uQuery.IGetProperty" filterName="uQuery.IGetProperty" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.uQuery.Members" filterName="uQuery.Members" isExposed="True" />
<Filter entryType="Enumeration" fullName="umbraco.uQuery.UmbracoObjectType" filterName="uQuery.UmbracoObjectType" isExposed="True" />
</Filter>
<Filter entryType="Namespace" fullName="umbraco.cms.presentation" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.create.controls" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.developer" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.developer.RelationTypes" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.developer.RelationTypes.TreeMenu" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.members" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.settings" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.settings.modal" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.settings.scripts" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.settings.stylesheet" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.cms.presentation.user" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.controls" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.controls.GenericProperties" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.controls.Images" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.controls.Tree" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.developer" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.dialogs" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.js" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.layoutControls" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.NodeFactory" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.actions" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.channels" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.channels.businesslogic" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.create" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.developer.packages" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.dialogs" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.masterpages" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.members" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.nodeFactory" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.org.umbraco.update" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.plugins.tinymce3" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.preview" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.Search" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.settings" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.templateControls" isExposed="False" xmlns="">
<Filter entryType="Class" fullName="umbraco.presentation.templateControls.Item" filterName="Item" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.presentation.templateControls.ItemRenderer" filterName="ItemRenderer" isExposed="True" />
<Filter entryType="Class" fullName="umbraco.presentation.templateControls.Macro" filterName="Macro" isExposed="True" />
<Filter entryType="Enumeration" fullName="umbraco.presentation.templateControls.Macro.RenderEvents" filterName="Macro.RenderEvents" isExposed="False" />
</Filter>
<Filter entryType="Namespace" fullName="umbraco.presentation.tinymce3" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.translation" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.channels" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.controls" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.create" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.developer.Xslt" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.dialogs" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.masterpages" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.members" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.plugins.tinymce3" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.Search" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.translation" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco.webservices" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.umbraco_client.tinymce3.plugins.spellchecker" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.urlRewriter" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.Web.UI" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.presentation.webservices" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.scripting" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.settings" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="Umbraco.Web.org.umbraco.our" isExposed="False" xmlns="" />
<Filter entryType="Namespace" fullName="umbraco.webservices" isExposed="False" xmlns="" /></ApiFilter>
</PropertyGroup>
<!-- There are no properties for these groups. AnyCPU needs to appear in
order for Visual Studio to perform the build. The others are optional
common platform types that may appear. -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
</PropertyGroup>
<!-- Import the SHFB build targets -->
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
</Project>
+10 -47
View File
@@ -11,28 +11,20 @@ FOR /F "skip=1 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED release SE
FOR /F "skip=2 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED comment SET "comment=%%i"
REM If there's arguments on the command line overrule UmbracoVersion.txt and use that as the version
IF [%2] NEQ [] (SET release=%2)
IF [%3] NEQ [] (SET comment=%3) ELSE (IF [%2] NEQ [] (SET "comment="))
REM Get the "is continuous integration" from the parameters
SET "isci=0"
IF [%1] NEQ [] (SET isci=1)
IF [%1] NEQ [] (SET release=%1)
IF [%2] NEQ [] (SET comment=%2) ELSE (IF [%1] NEQ [] (SET "comment="))
SET version=%release%
IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
ECHO.
IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
ECHO Building Umbraco %version%
ECHO.
ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %release%
ECHO.
ECHO Removing the belle build folder and bower_components folder to make sure everything is clean as a whistle
RD ..\src\Umbraco.Web.UI.Client\build /Q /S
RD ..\src\Umbraco.Web.UI.Client\bower_components /Q /S
ECHO.
ECHO Removing existing built files to make sure everything is clean as a whistle
RMDIR /Q /S _BuildOutput
DEL /F /Q UmbracoCms.*.zip
@@ -40,56 +32,27 @@ DEL /F /Q UmbracoExamine.*.zip
DEL /F /Q UmbracoCms.*.nupkg
DEL /F /Q webpihash.txt
ECHO.
ECHO Making sure Git is in the path so that the build can succeed
CALL InstallGit.cmd
REM Adding the default Git path so that if it's installed it can actually be found
REM This is necessary because SETLOCAL is on in InstallGit.cmd so that one might find Git,
REM but the path setting is lost due to SETLOCAL
path=C:\Program Files (x86)\Git\cmd;C:\Program Files\Git\cmd;%PATH%
ECHO.
ECHO Making sure we have a web.config
IF NOT EXIST %CD%\..\src\Umbraco.Web.UI\web.config COPY %CD%\..\src\Umbraco.Web.UI\web.Template.config %CD%\..\src\Umbraco.Web.UI\web.config
ECHO.
ECHO.
ECHO Performing MSBuild and producing Umbraco binaries zip files
ECHO This takes a few minutes and logging is set to report warnings
ECHO and errors only so it might seems like nothing is happening for a while.
ECHO You can check the msbuild.log file for progress.
ECHO.
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%release% /p:BUILD_COMMENT=%comment% /p:NugetPackagesDirectory=%nuGetFolder% /consoleloggerparameters:Summary;ErrorsOnly;WarningsOnly /fileLogger
IF ERRORLEVEL 1 GOTO :error
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%release% /p:BUILD_COMMENT=%comment% /verbosity:minimal
ECHO.
ECHO Setting node_modules folder to hidden to prevent VS13 from crashing on it while loading the websites project
attrib +h ..\src\Umbraco.Web.UI.Client\node_modules
ECHO.
ECHO Adding Web.config transform files to the NuGet package
REN .\_BuildOutput\WebApp\Views\Web.config Web.config.transform
REN .\_BuildOutput\WebApp\Xslt\Web.config Web.config.transform
ECHO.
ECHO Packing the NuGet release files
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Core.nuspec -Version %version% -Symbols -Verbosity quiet
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.nuspec -Version %version% -Verbosity quiet
IF ERRORLEVEL 1 GOTO :error
IF ERRORLEVEL 1 GOTO :showerror
:success
ECHO.
ECHO No errors were detected!
ECHO There may still be some in the output, which you would need to investigate.
ECHO Warnings are usually normal.
ECHO No errors were detected but you still may see some in the output, then it's time to investigate.
ECHO You might see some warnings but that is completely normal.
GOTO :EOF
:error
ECHO.
ECHO Errors were detected!
REM don't pause if continuous integration else the build server waits forever
REM before cancelling the build (and, there is noone to read the output anyways)
IF isci NEQ 1 PAUSE
:showerror
PAUSE
-1
View File
@@ -23,7 +23,6 @@ ECHO Change directory to %CD%\..\src\Umbraco.Web.UI.Client\
CD %CD%\..\src\Umbraco.Web.UI.Client\
ECHO Do npm install and the grunt build of Belle
call npm cache clean --quiet
call npm install --quiet
call npm install -g grunt-cli --quiet
call npm install -g bower --quiet
-20
View File
@@ -1,20 +0,0 @@
@ECHO OFF
SETLOCAL
SET release=%1
ECHO Installing Npm NuGet Package
SET nuGetFolder=%CD%\..\src\packages\
ECHO Configured packages folder: %nuGetFolder%
ECHO Current folder: %CD%
%CD%\..\src\.nuget\NuGet.exe install Npm.js -OutputDirectory %nuGetFolder% -Verbosity quiet
for /f "delims=" %%A in ('dir %nuGetFolder%node.js.* /b') do set "nodePath=%nuGetFolder%%%A\"
for /f "delims=" %%A in ('dir %nuGetFolder%npm.js.* /b') do set "npmPath=%nuGetFolder%%%A\tools\"
ECHO Adding Npm and Node to path
REM SETLOCAL is on, so changes to the path not persist to the actual user's path
PATH=%npmPath%;%nodePath%;%PATH%
Powershell.exe -ExecutionPolicy Unrestricted -File .\BuildDocs.ps1
+17 -90
View File
@@ -1,100 +1,27 @@
$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path);
$RepoRoot = (get-item $PSScriptFilePath).Directory.Parent.FullName;
$SolutionRoot = Join-Path -Path $RepoRoot "src";
$ToolsRoot = Join-Path -Path $RepoRoot "tools";
$DocFx = Join-Path -Path $ToolsRoot "docfx\docfx.exe"
$DocFxFolder = (Join-Path -Path $ToolsRoot "docfx")
$DocFxJson = Join-Path -Path $RepoRoot "apidocs\docfx.json"
$7Zip = Join-Path -Path $ToolsRoot "7zip\7za.exe"
$DocFxSiteOutput = Join-Path -Path $RepoRoot "apidocs\_site\*.*"
$NgDocsSiteOutput = Join-Path -Path $RepoRoot "src\Umbraco.Web.UI.Client\docs\api\*.*"
$ProgFiles86 = [Environment]::GetEnvironmentVariable("ProgramFiles(x86)");
$MSBuild = "$ProgFiles86\MSBuild\14.0\Bin\MSBuild.exe"
##We cannot continue if sandcastle is not installed determined by env variable: SHFBROOT
################ Do the UI docs
"Changing to Umbraco.Web.UI.Client folder"
cd ..
cd src\Umbraco.Web.UI.Client
Write-Host $(Get-Location)
"Creating build folder so MSBuild doesn't run the whole grunt build"
if (-Not (Test-Path "build")) {
md "build"
}
"Installing node"
# Check if Install-Product exists, should only exist on the build server
if (Get-Command Install-Product -errorAction SilentlyContinue)
if (-not (Test-Path Env:\SHFBROOT))
{
Install-Product node ''
throw "The docs cannot be build, install Sandcastle help file builder"
}
"Installing node modules"
& npm install
$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName
$BuildRoot = Split-Path -Path $PSScriptFilePath -Parent
$OutputPath = Join-Path -Path $BuildRoot -ChildPath "ApiDocs\Output"
$ProjFile = Join-Path -Path $BuildRoot -ChildPath "ApiDocs\csharp-api-docs.shfbproj"
"Installing grunt"
& npm install -g grunt-cli
"Building docs with project file: $ProjFile"
"Moving back to build folder"
cd ..
cd ..
cd build
Write-Host $(Get-Location)
$MSBuild = "$Env:SYSTEMROOT\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
& grunt --gruntfile ../src/umbraco.web.ui.client/gruntfile.js docs
# build it!
& $MSBuild "$ProjFile"
# change baseUrl
$BaseUrl = "https://our.umbraco.org/apidocs/ui/"
$IndexPath = "../src/umbraco.web.ui.client/docs/api/index.html"
(Get-Content $IndexPath).replace('location.href.replace(rUrl, indexFile)', "`'" + $BaseUrl + "`'") | Set-Content $IndexPath
# zip it
# remove files left over
Remove-Item $BuildRoot\* -include csharp-api-docs.shfbproj_*
& $7Zip a -tzip ui-docs.zip $NgDocsSiteOutput -r
# copy our custom styles in
Copy-Item $BuildRoot\ApiDocs\TOC.css $OutputPath\TOC.css
################ Do the c# docs
# Build the solution in debug mode
$SolutionPath = Join-Path -Path $SolutionRoot -ChildPath "umbraco.sln"
& $MSBuild "$SolutionPath" /p:Configuration=Debug /maxcpucount /t:Clean
if (-not $?)
{
throw "The MSBuild process returned an error code."
}
& $MSBuild "$SolutionPath" /p:Configuration=Debug /maxcpucount
if (-not $?)
{
throw "The MSBuild process returned an error code."
}
# Go get docfx if we don't hae it
$FileExists = Test-Path $DocFx
If ($FileExists -eq $False) {
If(!(Test-Path $DocFxFolder))
{
New-Item $DocFxFolder -type directory
}
$DocFxZip = Join-Path -Path $ToolsRoot "docfx\docfx.zip"
$DocFxSource = "https://github.com/dotnet/docfx/releases/download/v1.9.4/docfx.zip"
Invoke-WebRequest $DocFxSource -OutFile $DocFxZip
#unzip it
& $7Zip e $DocFxZip "-o$DocFxFolder"
}
#clear site
If(Test-Path(Join-Path -Path $RepoRoot "apidocs\_site"))
{
Remove-Item $DocFxSiteOutput -recurse
}
# run it!
& $DocFx metadata $DocFxJson
& $DocFx build $DocFxJson
# zip it
& $7Zip a -tzip csharp-docs.zip $DocFxSiteOutput -r
""
"Done!"
+13 -44
View File
@@ -1,33 +1,23 @@
@ECHO OFF
SETLOCAL
:: SETLOCAL is on, so changes to the path not persist to the actual user's path
REM SETLOCAL is on, so changes to the path not persist to the actual user's path
git.exe --version
IF %ERRORLEVEL%==9009 GOTO :trydefaultpath
git.exe 2> NUL
if %ERRORLEVEL%==9009 GOTO :trydefaultpath
GOTO :EOF
:: Git is installed, no need to to anything else
:trydefaultpath
PATH=C:\Program Files (x86)\Git\cmd;C:\Program Files\Git\cmd;%PATH%
git.exe --version
IF %ERRORLEVEL%==9009 GOTO :showerror
path=C:\Program Files (x86)\Git\cmd;C:\Program Files\Git\cmd;%PATH%
git.exe 2> NUL
if %ERRORLEVEL%==9009 GOTO :showerror
GOTO :EOF
:: Git is installed, no need to to anything else
:showerror
ECHO Git is not in your path and could not be found in C:\Program Files (x86)\Git\cmd nor in C:\Program Files\Git\cmd
SET /p install=" Do you want to install Git through Chocolatey [y/n]? " %=%
IF %install%==y (
:: Create a temporary batch file to execute either after elevating to admin or as-is when the user is already admin
ECHO @ECHO OFF > "%temp%\ChocoInstallGit.cmd"
ECHO SETLOCAL >> "%temp%\ChocoInstallGit.cmd"
ECHO ECHO Installing Chocolatey first >> "%temp%\ChocoInstallGit.cmd"
ECHO @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" >> "%temp%\ChocoInstallGit.cmd"
ECHO SET PATH=%%PATH%%;%%ALLUSERSPROFILE%%\chocolatey\bin >> "%temp%\ChocoInstallGit.cmd"
ECHO choco install git -y >> "%temp%\ChocoInstallGit.cmd"
set /p install=" Do you want to install Git through Chocolatey [y/n]? " %=%
if %install%==y (
GOTO :installgit
) ELSE (
) else (
GOTO :cantcontinue
)
@@ -36,28 +26,7 @@ ECHO Can't complete the build without Git being in the path. Please add it to be
GOTO :EOF
:installgit
pushd %~dp0
:: Running prompt elevated
:: --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: --> If error flag set, we do not have admin.
IF '%errorlevel%' NEQ '0' (
GOTO UACPrompt
) ELSE ( GOTO gotAdmin )
:UACPrompt
ECHO You're not currently running this with admin privileges, we'll now try to execute the install of Git through Chocolatey after elevating to admin privileges
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
ECHO UAC.ShellExecute "%temp%\ChocoInstallGit.cmd", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
EXIT /B
:gotAdmin
IF EXIST "%temp%\getadmin.vbs" ( DEL "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
CALL "%temp%\ChocoInstallGit.cmd"
ECHO Installing Chocolatey first
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
ECHO Installing Git through Chocolatey
choco install git
+6 -7
View File
@@ -27,17 +27,15 @@
<dependency id="SharpZipLib" version="[0.86.0, 1.0.0)" />
<dependency id="MySql.Data" version="[6.9.8, 7.0.0)" />
<dependency id="xmlrpcnet" version="[2.5.0, 3.0.0)" />
<dependency id="ClientDependency" version="[1.9.1, 2.0.0)" />
<dependency id="ClientDependency" version="[1.8.4, 2.0.0)" />
<dependency id="ClientDependency-Mvc5" version="[1.8.0, 2.0.0)" />
<!-- AutoMapper can not be updated due to: https://github.com/AutoMapper/AutoMapper/issues/373#issuecomment-127644405 -->
<dependency id="AutoMapper" version="[3.0.0, 3.1.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 10.0.0)" />
<dependency id="Examine" version="[0.1.69, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.4.4, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.6.4, 5.0.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 9.0.0)" />
<dependency id="Examine" version="[0.1.68, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.3.3, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.5.3, 5.0.0)" />
<dependency id="semver" version="[1.1.2, 2.0.0)" />
<dependency id="UrlRewritingNet" version="[2.0.7, 3.0.0)" />
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
<dependency id="Markdown" version="[1.14.4, 2.0.0)" />
</dependencies>
</metadata>
@@ -74,6 +72,7 @@
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.xml" target="lib\UmbracoExamine.xml" />
<file src="tools\install.core.ps1" target="tools\install.ps1" />
<file src="tools\uninstall.core.ps1" target="tools\uninstall.ps1" />
<!-- Added to be able to produce a symbols package -->
<file src="..\_BuildOutput\bin\SQLCE4Umbraco.pdb" target="lib" />
+4 -4
View File
@@ -16,8 +16,8 @@
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 10.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.4, 4.0.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 9.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.0, 4.0.0)" />
</dependencies>
</metadata>
<files>
@@ -32,8 +32,8 @@
<file src="..\_BuildOutput\WebApp\config\splashes\**" target="UmbracoFiles\Config\splashes" />
<file src="..\_BuildOutput\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
<file src="..\_BuildOutput\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
<file src="..\_BuildOutput\WebApp\Media\Web.config" target="Content\Media\Web.config" />
<file src="tools\install.ps1" target="tools\install.ps1" />
<file src="tools\uninstall.ps1" target="tools\uninstall.ps1" />
<file src="tools\Readme.txt" target="tools\Readme.txt" />
<file src="tools\ReadmeUpgrade.txt" target="tools\ReadmeUpgrade.txt" />
<file src="tools\Web.config.install.xdt" target="Content\Web.config.install.xdt" />
@@ -45,4 +45,4 @@
<file src="tools\Views.Web.config.install.xdt" target="Views\Web.config.install.xdt" />
<file src="build\**" target="build" />
</files>
</package>
</package>
@@ -21,12 +21,6 @@
</section>
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<areas xdt:Transform="InsertIfMissing">
<area xdt:Transform="InsertIfMissing">developer</area>
</areas>
</section>
<section alias="StartupDeveloperDashboardSection">
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Replace">
<control showOnce="true" addPanel="true" panelCaption="">
views/dashboard/developer/developerdashboardvideos.html
@@ -36,21 +30,16 @@
</section>
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
<control>
views/dashboard/developer/examinemanagement.html
</control>
</tab>
<tab caption="Health Check" xdt:Transform="InsertIfMissing" xdt:Locator="Match(caption)">
</tab>
<tab caption="Xml Data Integrity Report" xdt:Transform="InsertIfMissing">
<control>
views/dashboard/developer/healthcheck.html
views/dashboard/developer/xmldataintegrityreport.html
</control>
</tab>
<tab caption="Redirect URL Management" xdt:Transform="InsertIfMissing" xdt:Locator="Match(caption)">
<control>
views/dashboard/developer/redirecturls.html
</control>
</tab>
</tab>
</section>
<section alias="StartupMediaDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
@@ -63,6 +52,19 @@
</tab>
</section>
<section alias="StartupDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
<tab caption="Get Started" xdt:Transform="Insert">
<access>
<grant>admin</grant>
</access>
<control showOnce="true" addPanel="true" panelCaption="">
views/dashboard/default/startupdashboardintro.html
</control>
</tab>
<tab caption="Last Edits" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
</section>
<section alias="StartupMemberDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
<tab caption="Get Started" xdt:Transform="Insert">
@@ -78,6 +80,5 @@
<section alias="StartupDashboardSection">
<tab caption="Change Password" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
<tab caption="Last Edits" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
</section>
</dashBoard>
@@ -21,8 +21,6 @@
<appSettings xdt:Transform="InsertIfMissing" />
<appSettings>
<add key="owin:appStartup" value="UmbracoDefaultOwinStartup" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
<add key="Umbraco.ModelsBuilder.Enable" value="false" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
<add key="Umbraco.ModelsBuilder.ModelsMode" value="Nothing" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
</appSettings>
<umbracoConfiguration xdt:Transform="InsertIfMissing">
@@ -292,8 +290,6 @@
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<remove fileExtension=".woff" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<remove fileExtension=".woff2" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<remove fileExtension=".less" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<mimeMap fileExtension=".less" mimeType="text/css" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
</staticContent>
+1 -26
View File
@@ -77,33 +77,8 @@ if ($project) {
{
$packageWebConfigSource = Join-Path $installPath "UmbracoFiles\Web.config"
Copy-Item $packageWebConfigSource $destinationWebConfig -Force
}
# Copy files that don't get automatically copied for Website projects
# We do this here, when copyWebconfig is true because we only want to do it for new installs
# If this is an upgrade then the files should already be there
$splashesSource = Join-Path $installPath "UmbracoFiles\Config\splashes\*.*"
$splashesDestination = Join-Path $projectPath "Config\splashes\"
New-Item $splashesDestination -Type directory
Copy-Item $splashesSource $splashesDestination -Force
$sqlCe64Source = Join-Path $installPath "UmbracoFiles\bin\amd64\*"
$sqlCe64Destination = Join-Path $projectPath "bin\amd64\"
Copy-Item $sqlCe64Source $sqlCe64Destination -Force
$sqlCex86Source = Join-Path $installPath "UmbracoFiles\bin\x86\*"
$sqlCex86Destination = Join-Path $projectPath "bin\x86\"
Copy-Item $sqlCex86source $sqlCex86Destination -Force
$umbracoUIXMLSource = Join-Path $installPath "UmbracoFiles\Umbraco\Config\Create\UI.xml"
$umbracoUIXMLDestination = Join-Path $projectPath "Umbraco\Config\Create\UI.xml"
Copy-Item $umbracoUIXMLSource $umbracoUIXMLDestination -Force
} else {
$upgradeViewSource = Join-Path $umbracoFolderSource "Views\install\*"
$upgradeView = Join-Path $umbracoFolder "Views\install\"
Write-Host "Copying2 ${upgradeViewSource} to ${upgradeView}"
Copy-Item $upgradeViewSource $upgradeView -Force
}
$installFolder = Join-Path $projectPath "Install"
if(Test-Path $installFolder) {
Remove-Item $installFolder -Force -Recurse -Confirm:$false
+9 -17
View File
@@ -55,29 +55,21 @@
xdt:Transform="SetAttributes()" />
<!--Developer-->
<add alias="packager" application="developer"
<add alias="datatype" application="developer"
xdt:Locator="Match(application,alias)"
xdt:Transform="Remove" />
<add alias="packagerPackages" application="developer"
<add initialize="true" sortOrder="0" alias="datatypes" application="developer" title="Data Types" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.DataTypeTreeController, umbraco"
xdt:Locator="Match(application,alias)"
xdt:Transform="Remove" />
<add initialize="true" sortOrder="0" alias="packager" application="developer" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.PackagesTreeController, umbraco"
xdt:Locator="Match(application,alias)"
xdt:Transform="InsertIfMissing" />
<!-- Before 7.4 this tree had the alias 'dataType', without the 's' on the end, this is here to rename it -->
<add sortOrder="1" alias="dataTypes" application="developer" type="Umbraco.Web.Trees.DataTypeTreeController, umbraco"
xdt:Locator="Match(application,type)"
xdt:Transform="SetAttributes(alias,sortOrder)" />
<!-- Yes, set the sortOrder again, like above because.. sometimes apparently we already have a dataTypes node and we can't remove more than one.. if they're equal though (same alias,application and sortOrder) it doesn't throw an error -->
<add sortOrder="1" alias="dataTypes" application="developer"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes(sortOrder)" />
xdt:Transform="InsertIfMissing" />
<add application="developer" alias="macros" title="Macros" type="umbraco.loadMacros, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="2"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="packager" title="Packages" type="umbraco.loadPackager, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="packagerPackages" title="Packager Packages" type="umbraco.loadPackages, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" initialize="false" sortOrder="3"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="relationTypes" title="Relation Types" type="umbraco.loadRelationTypes, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
+48
View File
@@ -0,0 +1,48 @@
param($installPath, $toolsPath, $package, $project)
Write-Host "installPath:" "${installPath}"
Write-Host "toolsPath:" "${toolsPath}"
Write-Host " "
if ($project) {
# Create paths and list them
$projectPath = (Get-Item $project.Properties.Item("FullPath").Value).FullName
Write-Host "projectPath:" "${projectPath}"
$backupPath = Join-Path $projectPath "App_Data\NuGetBackup"
Write-Host "backupPath:" "${backupPath}"
$umbracoBinFolder = Join-Path $projectPath "bin"
Write-Host "umbracoBinFolder:" "${umbracoBinFolder}"
# Remove backups
Write-Host "removing backups:" "${backupPath}"
if(Test-Path $backupPath) { Remove-Item -Recurse -Force $backupPath -Confirm:$false }
# Delete files Umbraco ships with
Write-Host "removing dlls:" "${umbracoBinFolder}"
if(Test-Path $umbracoBinFolder\businesslogic.dll) { Remove-Item $umbracoBinFolder\businesslogic.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\cms.dll) { Remove-Item $umbracoBinFolder\cms.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\controls.dll) { Remove-Item $umbracoBinFolder\controls.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\interfaces.dll) { Remove-Item $umbracoBinFolder\interfaces.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\log4net.dll) { Remove-Item $umbracoBinFolder\log4net.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\Microsoft.ApplicationBlocks.Data.dll) { Remove-Item $umbracoBinFolder\Microsoft.ApplicationBlocks.Data.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\SQLCE4Umbraco.dll) { Remove-Item $umbracoBinFolder\SQLCE4Umbraco.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\System.Data.SqlServerCe.dll) { Remove-Item $umbracoBinFolder\System.Data.SqlServerCe.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\System.Data.SqlServerCe.Entity.dll) { Remove-Item $umbracoBinFolder\System.Data.SqlServerCe.Entity.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\TidyNet.dll) { Remove-Item $umbracoBinFolder\TidyNet.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.dll) { Remove-Item $umbracoBinFolder\umbraco.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\Umbraco.Core.dll) { Remove-Item $umbracoBinFolder\Umbraco.Core.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.DataLayer.dll) { Remove-Item $umbracoBinFolder\umbraco.DataLayer.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.editorControls.dll) { Remove-Item $umbracoBinFolder\umbraco.editorControls.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.MacroEngines.dll) { Remove-Item $umbracoBinFolder\umbraco.MacroEngines.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\umbraco.providers.dll) { Remove-Item $umbracoBinFolder\umbraco.providers.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\Umbraco.Web.UI.dll) { Remove-Item $umbracoBinFolder\Umbraco.Web.UI.dll -Force -Confirm:$false }
if(Test-Path $umbracoBinFolder\UmbracoExamine.dll) { Remove-Item $umbracoBinFolder\UmbracoExamine.dll -Force -Confirm:$false }
$amd64Folder = Join-Path $umbracoBinFolder "amd64"
if(Test-Path $amd64Folder) { Remove-Item $amd64Folder -Force -Recurse -Confirm:$false }
$x86Folder = Join-Path $umbracoBinFolder "x86"
if(Test-Path $x86Folder) { Remove-Item $x86Folder -Force -Recurse -Confirm:$false }
}
+39
View File
@@ -0,0 +1,39 @@
param($installPath, $toolsPath, $package, $project)
Write-Host "installPath:" "${installPath}"
Write-Host "toolsPath:" "${toolsPath}"
Write-Host " "
if ($project) {
# Create paths and list them
$projectPath = (Get-Item $project.Properties.Item("FullPath").Value).FullName
Write-Host "projectPath:" "${projectPath}"
$backupPath = Join-Path $projectPath "App_Data\NuGetBackup"
Write-Host "backupPath:" "${backupPath}"
$appBrowsers = Join-Path $projectPath "App_Browsers"
Write-Host "appBrowsers:" "${appBrowsers}"
$appData = Join-Path $projectPath "App_Data"
Write-Host "appData:" "${appData}"
# Remove backups
Write-Host "removing backups:" "${backupPath}"
if(Test-Path $backupPath) { Remove-Item -Recurse -Force $backupPath -Confirm:$false }
# Remove app_data files
Write-Host "removing app_data files:" "${appData}"
if(Test-Path $appData\packages) { Remove-Item $appData\packages -Recurse -Force -Confirm:$false }
Write-Host "removing app_browsers:" "${appBrowsers}"
if(Test-Path $appBrowsers\Form.browser) { Remove-Item $appBrowsers\Form.browser -Force -Confirm:$false }
if(Test-Path $appBrowsers\w3cvalidator.browser) { Remove-Item $appBrowsers\w3cvalidator.browser -Force -Confirm:$false }
# Remove umbraco and umbraco_files
$umbracoFolder = Join-Path $projectPath "Umbraco"
Write-Host "removing umbraco folder:" "${umbracoFolder}"
if(Test-Path $umbracoFolder) { Remove-Item $umbracoFolder -Recurse -Force -Confirm:$false }
$umbracoClientFolder = Join-Path $projectPath "Umbraco_Client"
Write-Host "removing umbraco client folder:" "${umbracoClientFolder}"
if(Test-Path $umbracoClientFolder) { Remove-Item $umbracoClientFolder -Recurse -Force -Confirm:$false }
}
+1 -1
View File
@@ -1,2 +1,2 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.5.2
7.4.1
+9 -4
View File
@@ -40,10 +40,15 @@ namespace SqlCE4Umbraco
var localConnection = new SqlCeConnection(ConnectionString);
if (!System.IO.File.Exists(ReplaceDataDirectory(localConnection.Database)))
{
using (var sqlCeEngine = new SqlCeEngine(ConnectionString))
{
sqlCeEngine.CreateDatabase();
}
var sqlCeEngine = new SqlCeEngine(ConnectionString);
sqlCeEngine.CreateDatabase();
// SD: Pretty sure this should be in a using clause but i don't want to cause unknown side-effects here
// since it's been like this for quite some time
//using (var sqlCeEngine = new SqlCeEngine(ConnectionString))
//{
// sqlCeEngine.CreateDatabase();
//}
}
}
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.5.2")]
[assembly: AssemblyInformationalVersion("7.5.2")]
[assembly: AssemblyFileVersion("7.4.1")]
[assembly: AssemblyInformationalVersion("7.4.1")]
@@ -9,9 +9,6 @@ namespace Umbraco.Core.Cache
/// <summary>
/// A cache provider that caches items in the HttpContext.Items
/// </summary>
/// <remarks>
/// If the Items collection is null, then this provider has no effect
/// </remarks>
internal class HttpRequestCacheProvider : DictionaryCacheProviderBase
{
// context provider
@@ -37,11 +34,6 @@ namespace Umbraco.Core.Cache
get { return _context != null ? _context.Items : HttpContext.Current.Items; }
}
private bool HasContextItems
{
get { return (_context != null && _context.Items != null) || HttpContext.Current != null; }
}
// for unit tests
public HttpRequestCacheProvider(HttpContextBase context)
{
@@ -58,23 +50,18 @@ namespace Umbraco.Core.Cache
protected override IEnumerable<DictionaryEntry> GetDictionaryEntries()
{
const string prefix = CacheItemPrefix + "-";
if (HasContextItems == false) return Enumerable.Empty<DictionaryEntry>();
return ContextItems.Cast<DictionaryEntry>()
.Where(x => x.Key is string && ((string)x.Key).StartsWith(prefix));
}
protected override void RemoveEntry(string key)
{
if (HasContextItems == false) return;
ContextItems.Remove(key);
}
protected override object GetEntry(string key)
{
return HasContextItems ? ContextItems[key] : null;
return ContextItems[key];
}
#region Lock
@@ -94,9 +81,7 @@ namespace Umbraco.Core.Cache
get
{
return HasContextItems
? (IDisposable) new MonitorLock(ContextItems.SyncRoot)
: new NoopLocker();
return new MonitorLock(ContextItems.SyncRoot);
}
}
@@ -106,9 +91,6 @@ namespace Umbraco.Core.Cache
public override object GetCacheItem(string cacheKey, Func<object> getCacheItem)
{
//no place to cache so just return the callback result
if (HasContextItems == false) return getCacheItem();
cacheKey = GetCacheKey(cacheKey);
Lazy<object> result;
@@ -146,10 +128,5 @@ namespace Umbraco.Core.Cache
#region Insert
#endregion
private class NoopLocker : DisposableObject
{
protected override void DisposeResources()
{ }
}
}
}
+2 -2
View File
@@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace Umbraco.Core.Cache
{
/// <summary>
/// An interface for implementing a basic cache provider
/// An abstract class for implementing a basic cache provider
/// </summary>
public interface ICacheProvider
{
@@ -65,4 +65,4 @@ namespace Umbraco.Core.Cache
object GetCacheItem(string cacheKey, Func<object> getCacheItem);
}
}
}
+21 -12
View File
@@ -5,31 +5,38 @@ using System.Web.Caching;
namespace Umbraco.Core.Cache
{
/// <summary>
/// Represents a cache provider that does not cache anything.
/// </summary>
public class NullCacheProvider : IRuntimeCacheProvider
internal class NullCacheProvider : IRuntimeCacheProvider
{
public virtual void ClearAllCache()
{ }
{
}
public virtual void ClearCacheItem(string key)
{ }
{
}
public virtual void ClearCacheObjectTypes(string typeName)
{ }
{
}
public virtual void ClearCacheObjectTypes<T>()
{ }
{
}
public virtual void ClearCacheObjectTypes<T>(Func<string, T, bool> predicate)
{ }
{
}
public virtual void ClearCacheByKeySearch(string keyStartsWith)
{ }
{
}
public virtual void ClearCacheByKeyExpression(string regexString)
{ }
{
}
public virtual IEnumerable<object> GetCacheItemsByKeySearch(string keyStartsWith)
{
@@ -57,6 +64,8 @@ namespace Umbraco.Core.Cache
}
public void InsertCacheItem(string cacheKey, Func<object> getCacheItem, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, CacheItemRemovedCallback removedCallback = null, string[] dependentFiles = null)
{ }
{
}
}
}
@@ -1,23 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.Caching;
using System.Text.RegularExpressions;
using System.Threading;
using System.Web.Caching;
using Umbraco.Core.Logging;
using CacheItemPriority = System.Web.Caching.CacheItemPriority;
namespace Umbraco.Core.Cache
{
/// <summary>
/// Represents a cache provider that caches item in a <see cref="MemoryCache"/>.
/// A cache provider that wraps the logic of a System.Runtime.Caching.ObjectCache
/// </summary>
/// <remarks>The <see cref="MemoryCache"/> is created with name "in-memory". That name is
/// used to retrieve configuration options. It does not identify the memory cache, i.e.
/// each instance of this class has its own, independent, memory cache.</remarks>
public class ObjectCacheRuntimeCacheProvider : IRuntimeCacheProvider
internal class ObjectCacheRuntimeCacheProvider : IRuntimeCacheProvider
{
private readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
internal ObjectCache MemoryCache;
@@ -3,13 +3,14 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web.Caching;
namespace Umbraco.Core.Cache
{
/// <summary>
/// Represents a cache provider that statically caches item in a concurrent dictionary.
/// A cache provider that statically caches everything in an in memory dictionary
/// </summary>
public class StaticCacheProvider : ICacheProvider
internal class StaticCacheProvider : ICacheProvider
{
internal readonly ConcurrentDictionary<string, object> StaticCache = new ConcurrentDictionary<string, object>();
@@ -74,6 +75,7 @@ namespace Umbraco.Core.Cache
public virtual object GetCacheItem(string cacheKey, Func<object> getCacheItem)
{
return StaticCache.GetOrAdd(cacheKey, key => getCacheItem());
}
}
}
}
@@ -291,19 +291,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
true);
}
}
[ConfigurationProperty("EnableInheritedMediaTypes")]
internal InnerTextConfigurationElement<bool> EnableInheritedMediaTypes
{
get
{
return new OptionalInnerTextConfigurationElement<bool>(
(InnerTextConfigurationElement<bool>)this["EnableInheritedMediaTypes"],
//set the default
true);
}
}
string IContentSection.NotificationEmailAddress
{
get { return Notifications.NotificationEmailAddress; }
@@ -443,10 +431,5 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return EnableInheritedDocumentTypes; }
}
bool IContentSection.EnableInheritedMediaTypes
{
get { return EnableInheritedMediaTypes; }
}
}
}
@@ -61,7 +61,5 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
string DefaultDocumentTypeProperty { get; }
bool EnableInheritedDocumentTypes { get; }
bool EnableInheritedMediaTypes { get; }
}
}
@@ -6,8 +6,6 @@
bool HideDisabledUsersInBackoffice { get; }
bool AllowPasswordReset { get; }
string AuthCookieName { get; }
string AuthCookieDomain { get; }
@@ -9,8 +9,6 @@
bool DisableAlternativeTemplates { get; }
bool DisableFindContentByIdPath { get; }
bool DisableRedirectUrlTracking { get; }
string UrlProviderMode { get; }
@@ -28,18 +28,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
[ConfigurationProperty("allowPasswordReset")]
internal InnerTextConfigurationElement<bool> AllowPasswordReset
{
get
{
return new OptionalInnerTextConfigurationElement<bool>(
(InnerTextConfigurationElement<bool>)this["allowPasswordReset"],
//set the default
true);
}
}
[ConfigurationProperty("authCookieName")]
internal InnerTextConfigurationElement<string> AuthCookieName
{
@@ -74,11 +62,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return HideDisabledUsersInBackoffice; }
}
bool ISecuritySection.AllowPasswordReset
{
get { return AllowPasswordReset; }
}
string ISecuritySection.AuthCookieName
{
get { return AuthCookieName; }
@@ -27,12 +27,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (bool) base["disableFindContentByIdPath"]; }
}
[ConfigurationProperty("disableRedirectUrlTracking", DefaultValue = "false")]
public bool DisableRedirectUrlTracking
{
get { return (bool) base["disableRedirectUrlTracking"]; }
}
[ConfigurationProperty("urlProviderMode", DefaultValue = "AutoLegacy")]
public string UrlProviderMode
{
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.5.2");
private static readonly Version Version = new Version("7.4.1");
/// <summary>
/// Gets the current version of Umbraco.
@@ -73,11 +73,6 @@
/// </summary>
public const string DataTypes = "dataTypes";
/// <summary>
/// alias for the packages tree
/// </summary>
public const string Packages = "packager";
/// <summary>
/// alias for the dictionary tree.
/// </summary>
+7 -20
View File
@@ -1,23 +1,15 @@
namespace Umbraco.Core
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Core
{
public static partial class Constants
{
public static class Examine
{
/// <summary>
/// The alias of the internal member indexer
/// </summary>
public const string InternalMemberIndexer = "InternalMemberIndexer";
/// <summary>
/// The alias of the internal content indexer
/// </summary>
public const string InternalIndexer = "InternalIndexer";
/// <summary>
/// The alias of the external content indexer
/// </summary>
public const string ExternalIndexer = "ExternalIndexer";
/// <summary>
/// The alias of the internal member searcher
/// </summary>
@@ -27,11 +19,6 @@
/// The alias of the internal content searcher
/// </summary>
public const string InternalSearcher = "InternalSearcher";
/// <summary>
/// The alias of the external content searcher
/// </summary>
public const string ExternalSearcher = "ExternalSearcher";
}
}
}
+1 -4
View File
@@ -143,10 +143,7 @@ namespace Umbraco.Core
/// </summary>
public const string LockObject = "87A9F1FF-B1E4-4A25-BABB-465A4A47EC41";
/// <summary>
/// Guid for a Lock object.
/// </summary>
public static readonly Guid LockObjectGuid = new Guid(LockObject);
}
}
}
+4 -13
View File
@@ -11,7 +11,7 @@ namespace Umbraco.Core
{
/// <summary>
/// Used to prefix generic properties that are internal content properties
/// </summary>
/// </summary>
public const string InternalGenericPropertiesPrefix = "_umb_";
/// <summary>
@@ -74,7 +74,7 @@ namespace Umbraco.Core
/// </summary>
[Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")]
public const string DictionaryPicker = "17B70066-F764-407D-AB05-3717F1E1C513";
/// <summary>
/// Guid for the Dropdown list datatype.
/// </summary>
@@ -352,7 +352,7 @@ namespace Umbraco.Core
/// </summary>
[Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")]
public const string UltimatePicker = "CDBF0B5D-5CB2-445F-BC12-FCAAEC07CF2C";
/// <summary>
/// Guid for the UltraSimpleEditor datatype.
/// </summary>
@@ -369,7 +369,7 @@ namespace Umbraco.Core
/// </summary>
[Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")]
public const string UmbracoUserControlWrapper = "D15E1281-E456-4B24-AA86-1DDA3E4299D5";
/// <summary>
/// Guid for the Upload field datatype.
/// </summary>
@@ -419,15 +419,6 @@ namespace Umbraco.Core
/// Alias for the email address property editor
/// </summary>
public const string EmailAddressAlias = "Umbraco.EmailAddress";
public static class PreValueKeys
{
/// <summary>
/// Pre-value name used to indicate a field that can be used to override the database field to which data for the associated
/// property is saved
/// </summary>
public const string DataValueType = "umbracoDataValueType";
}
}
}
}
+23 -30
View File
@@ -1,40 +1,33 @@
namespace Umbraco.Core
{
public static partial class Constants
{
/// <summary>
/// Defines the identifiers for Umbraco system nodes.
/// </summary>
public static class System
{
/// <summary>
/// The integer identifier for global system root node.
/// </summary>
public const int Root = -1;
public static partial class Constants
{
/// <summary>
/// Defines the identifiers for Umbraco system nodes.
/// </summary>
public static class System
{
/// <summary>
/// The integer identifier for global system root node.
/// </summary>
public const int Root = -1;
/// <summary>
/// The integer identifier for content's recycle bin.
/// </summary>
public const int RecycleBinContent = -20;
/// <summary>
/// The integer identifier for content's recycle bin.
/// </summary>
public const int RecycleBinContent = -20;
/// <summary>
/// The integer identifier for media's recycle bin.
/// </summary>
public const int RecycleBinMedia = -21;
/// <summary>
/// The integer identifier for media's recycle bin.
/// </summary>
public const int RecycleBinMedia = -21;
public const int DefaultContentListViewDataTypeId = -95;
public const int DefaultContentListViewDataTypeId = -95;
public const int DefaultMediaListViewDataTypeId = -96;
public const int DefaultMembersListViewDataTypeId = -97;
// identifiers for lock objects
public const int ServersLock = -331;
}
public static class DatabaseProviders
{
public const string SqlCe = "System.Data.SqlServerCe.4.0";
public const string SqlServer = "System.Data.SqlClient";
public const string MySql = "MySql.Data.MySqlClient";
}
}
public const int ServersLock = -331;
}
}
}
+70 -20
View File
@@ -135,7 +135,7 @@ namespace Umbraco.Core
if (string.IsNullOrEmpty(_providerName) == false)
return _providerName;
_providerName = Constants.DatabaseProviders.SqlServer;
_providerName = "System.Data.SqlClient";
if (ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName] != null)
{
if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName) == false)
@@ -212,10 +212,10 @@ namespace Umbraco.Core
{
var provider = DbConnectionExtensions.DetectProviderFromConnectionString(connectionString);
var databaseProvider = provider.ToString();
var providerName = Constants.DatabaseProviders.SqlServer;
var providerName = "System.Data.SqlClient";
if (databaseProvider.ToLower().Contains("mysql"))
{
providerName = Constants.DatabaseProviders.MySql;
providerName = "MySql.Data.MySqlClient";
}
SaveConnectionString(connectionString, providerName);
Initialize(string.Empty);
@@ -240,10 +240,10 @@ namespace Umbraco.Core
public string GetDatabaseConnectionString(string server, string databaseName, string user, string password, string databaseProvider, out string providerName)
{
providerName = Constants.DatabaseProviders.SqlServer;
providerName = "System.Data.SqlClient";
if (databaseProvider.ToLower().Contains("mysql"))
{
providerName = Constants.DatabaseProviders.MySql;
providerName = "MySql.Data.MySqlClient";
return string.Format("Server={0}; Database={1};Uid={2};Pwd={3}", server, databaseName, user, password);
}
if (databaseProvider.ToLower().Contains("azure"))
@@ -260,7 +260,7 @@ namespace Umbraco.Core
/// <param name="databaseName">Name of the database</param>
public void ConfigureIntegratedSecurityDatabaseConnection(string server, string databaseName)
{
const string providerName = Constants.DatabaseProviders.SqlServer;
const string providerName = "System.Data.SqlClient";
var connectionString = GetIntegratedSecurityDatabaseConnectionString(server, databaseName);
SaveConnectionString(connectionString, providerName);
Initialize(providerName);
@@ -373,7 +373,7 @@ namespace Umbraco.Core
var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName];
if (databaseSettings != null && string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) == false && string.IsNullOrWhiteSpace(databaseSettings.ProviderName) == false)
{
var providerName = Constants.DatabaseProviders.SqlServer;
var providerName = "System.Data.SqlClient";
string connString = null;
if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName))
{
@@ -381,7 +381,8 @@ namespace Umbraco.Core
connString = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ConnectionString;
}
Initialize(providerName, connString);
DetermineSqlServerVersion();
}
else if (ConfigurationManager.AppSettings.ContainsKey(GlobalSettings.UmbracoConnectionName) && string.IsNullOrEmpty(ConfigurationManager.AppSettings[GlobalSettings.UmbracoConnectionName]) == false)
{
@@ -394,8 +395,8 @@ namespace Umbraco.Core
else if (legacyConnString.ToLowerInvariant().Contains("tcp:"))
{
//Must be sql azure
SaveConnectionString(legacyConnString, Constants.DatabaseProviders.SqlServer);
Initialize(Constants.DatabaseProviders.SqlServer);
SaveConnectionString(legacyConnString, "System.Data.SqlClient");
Initialize("System.Data.SqlClient");
}
else if (legacyConnString.ToLowerInvariant().Contains("datalayer=mysql"))
{
@@ -406,19 +407,20 @@ namespace Umbraco.Core
foreach (var variable in legacyConnString.Split(';').Where(x => x.ToLowerInvariant().StartsWith("datalayer") == false))
connectionStringWithoutDatalayer = string.Format("{0}{1};", connectionStringWithoutDatalayer, variable);
SaveConnectionString(connectionStringWithoutDatalayer, Constants.DatabaseProviders.MySql);
Initialize(Constants.DatabaseProviders.MySql);
SaveConnectionString(connectionStringWithoutDatalayer, "MySql.Data.MySqlClient");
Initialize("MySql.Data.MySqlClient");
}
else
{
//Must be sql
SaveConnectionString(legacyConnString, Constants.DatabaseProviders.SqlServer);
Initialize(Constants.DatabaseProviders.SqlServer);
SaveConnectionString(legacyConnString, "System.Data.SqlClient");
Initialize("System.Data.SqlClient");
}
//Remove the legacy connection string, so we don't end up in a loop if something goes wrong.
GlobalSettings.RemoveSetting(GlobalSettings.UmbracoConnectionName);
DetermineSqlServerVersion();
}
else
{
@@ -463,6 +465,49 @@ namespace Umbraco.Core
Initialize(providerName);
}
/// <summary>
/// Set the lazy resolution of determining the SQL server version if that is the db type we're using
/// </summary>
private void DetermineSqlServerVersion()
{
var sqlServerSyntax = SqlSyntax as SqlServerSyntaxProvider;
if (sqlServerSyntax != null)
{
//this will not execute now, it is lazy so will only execute when we need to actually know
// the sql server version.
sqlServerSyntax.VersionName = new Lazy<SqlServerVersionName>(() =>
{
try
{
var database = this._factory.CreateDatabase();
var version = database.ExecuteScalar<string>("SELECT SERVERPROPERTY('productversion')");
var firstPart = version.Split('.')[0];
switch (firstPart)
{
case "11":
return SqlServerVersionName.V2012;
case "10":
return SqlServerVersionName.V2008;
case "9":
return SqlServerVersionName.V2005;
case "8":
return SqlServerVersionName.V2000;
case "7":
return SqlServerVersionName.V7;
default:
return SqlServerVersionName.Other;
}
}
catch (Exception)
{
return SqlServerVersionName.Invalid;
}
});
}
}
internal DatabaseSchemaResult ValidateDatabaseSchema()
{
if (_configured == false || (string.IsNullOrEmpty(_connectionString) || string.IsNullOrEmpty(ProviderName)))
@@ -472,7 +517,7 @@ namespace Umbraco.Core
{
if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted
&& ProviderName == Constants.DatabaseProviders.MySql)
&& ProviderName == "MySql.Data.MySqlClient")
{
throw new InvalidOperationException("Cannot use MySql in Medium Trust configuration");
}
@@ -580,8 +625,13 @@ namespace Umbraco.Core
var installedSchemaVersion = new SemVersion(schemaResult.DetermineInstalledVersion());
var installedMigrationVersion = schemaResult.DetermineInstalledVersionByMigrations(migrationEntryService);
var installedMigrationVersion = new SemVersion(0);
//we cannot check the migrations table if it doesn't exist, this will occur when upgrading to 7.3
if (schemaResult.ValidTables.Any(x => x.InvariantEquals("umbracoMigration")))
{
installedMigrationVersion = schemaResult.DetermineInstalledVersionByMigrations(migrationEntryService);
}
var targetVersion = UmbracoVersion.Current;
//In some cases - like upgrading from 7.2.6 -> 7.3, there will be no migration information in the database and therefore it will
@@ -681,7 +731,7 @@ namespace Umbraco.Core
private Attempt<Result> CheckReadyForInstall()
{
if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted
&& ProviderName == Constants.DatabaseProviders.MySql)
&& ProviderName == "MySql.Data.MySqlClient")
{
throw new InvalidOperationException("Cannot use MySql in Medium Trust configuration");
}
@@ -730,7 +780,7 @@ namespace Umbraco.Core
{
var dbIsSqlCe = false;
if (databaseSettings != null && databaseSettings.ProviderName != null)
dbIsSqlCe = databaseSettings.ProviderName == Constants.DatabaseProviders.SqlCe;
dbIsSqlCe = databaseSettings.ProviderName == "System.Data.SqlServerCe.4.0";
var sqlCeDatabaseExists = false;
if (dbIsSqlCe)
{
-23
View File
@@ -1,23 +0,0 @@
namespace Umbraco.Core
{
/// <summary>
/// Provides extension methods for System.Decimal.
/// </summary>
/// <remarks>See System.Decimal on MSDN and also
/// http://stackoverflow.com/questions/4298719/parse-decimal-and-filter-extra-0-on-the-right/4298787#4298787.
/// </remarks>
public static class DecimalExtensions
{
/// <summary>
/// Gets the normalized value.
/// </summary>
/// <param name="value">The value to normalize.</param>
/// <returns>The normalized value.</returns>
/// <remarks>Normalizing changes the scaling factor and removes trailing zeroes,
/// so 1.2500m comes out as 1.25m.</remarks>
public static decimal Normalize(this decimal value)
{
return value / 1.000000000000000000000000000000000m;
}
}
}
@@ -5,10 +5,8 @@ using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Linq.Expressions;
using System.Text;
using System.Web.Services.Description;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Dynamics
{
@@ -22,20 +20,6 @@ namespace Umbraco.Core.Dynamics
/// </summary>
private static readonly ConcurrentDictionary<Tuple<Type, string, int>, MethodInfo[]> MethodCache = new ConcurrentDictionary<Tuple<Type, string, int>, MethodInfo[]>();
private static IEnumerable<Type> GetTypes(Assembly a)
{
try
{
return TypeFinder.GetTypesWithFormattedException(a);
}
catch (ReflectionTypeLoadException ex)
{
// is this going to flood the log?
LogHelper.Error(typeof (ExtensionMethodFinder), "Failed to get types.", ex);
return Enumerable.Empty<Type>();
}
}
/// <summary>
/// Returns the enumerable of all extension method info's in the app domain = USE SPARINGLY!!!
/// </summary>
@@ -52,7 +36,7 @@ namespace Umbraco.Core.Dynamics
// assemblies that contain extension methods
.Where(a => a.IsDefined(typeof (ExtensionAttribute), false))
// types that contain extension methods
.SelectMany(a => GetTypes(a)
.SelectMany(a => a.GetTypes()
.Where(t => t.IsDefined(typeof (ExtensionAttribute), false) && t.IsSealed && t.IsGenericType == false && t.IsNested == false))
// actual extension methods
.SelectMany(t => t.GetMethods(BindingFlags.Static | BindingFlags.Public)
@@ -61,9 +45,9 @@ namespace Umbraco.Core.Dynamics
.Concat(typeof (Enumerable).GetMethods(BindingFlags.Static | BindingFlags.Public))
//If we don't do this then we'll be scanning all assemblies each time!
.ToArray(),
//only cache for 5 minutes
timeout: TimeSpan.FromMinutes(5),
timeout: TimeSpan.FromMinutes(5),
//each time this is accessed it will be for 5 minutes longer
isSliding:true);
@@ -73,7 +57,7 @@ namespace Umbraco.Core.Dynamics
/// Returns all extension methods found matching the definition
/// </summary>
/// <param name="runtimeCache">
/// The runtime cache is used to temporarily cache all extension methods found in the app domain so that
/// The runtime cache is used to temporarily cache all extension methods found in the app domain so that
/// while we search for individual extension methods, the process will be reasonably 'quick'. We then statically
/// cache the MethodInfo's that we are looking for and then the runtime cache will expire and give back all that memory.
/// </param>
@@ -94,7 +78,7 @@ namespace Umbraco.Core.Dynamics
{
var candidates = GetAllExtensionMethodsInAppDomain(runtimeCache);
// filter by name
// filter by name
var filtr1 = candidates.Where(m => m.Name == name);
// filter by args count
@@ -118,7 +102,7 @@ namespace Umbraco.Core.Dynamics
return filtr3.ToArray();
});
}
private static MethodInfo DetermineMethodFromParams(IEnumerable<MethodInfo> methods, Type genericType, IEnumerable<object> args)
@@ -139,12 +123,12 @@ namespace Umbraco.Core.Dynamics
types = method.GetParameters().Select(pi => pi.ParameterType).Skip(1)
});
//This type comparer will check
//This type comparer will check
var typeComparer = new DelegateEqualityComparer<Type>(
//Checks if the argument type passed in can be assigned from the parameter type in the method. For
//Checks if the argument type passed in can be assigned from the parameter type in the method. For
// example, if the argument type is HtmlHelper<MyModel> but the method parameter type is HtmlHelper then
// it will match because the argument is assignable to that parameter type and will be able to execute
TypeHelper.IsTypeAssignableFrom,
TypeHelper.IsTypeAssignableFrom,
//This will not ever execute but if it does we need to get the hash code of the string because the hash
// code of a type is random
type => type.FullName.GetHashCode());
@@ -175,7 +159,7 @@ namespace Umbraco.Core.Dynamics
.ToArray();
var methods = GetAllExtensionMethods(runtimeCache, thisType, name, args.Length).ToArray();
return DetermineMethodFromParams(methods, genericType, args);
}
}
+20 -59
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using Semver;
using Umbraco.Core.Configuration;
using Umbraco.Core.Persistence.Migrations;
namespace Umbraco.Core.Events
@@ -14,50 +13,24 @@ namespace Umbraco.Core.Events
/// </summary>
/// <param name="eventObject"></param>
/// <param name="targetVersion"></param>
/// <param name="productName"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion, string productName, bool canCancel)
: this(eventObject, null, configuredVersion, targetVersion, productName, canCancel)
{ }
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
/// <param name="eventObject"></param>
/// <param name="targetVersion"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
[Obsolete("Use constructor accepting a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion, bool canCancel)
: this(eventObject, null, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName, canCancel)
{ }
[Obsolete("Use constructor accepting SemVersion instances and a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, Version configuredVersion, Version targetVersion, bool canCancel)
: this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), GlobalSettings.UmbracoMigrationName, canCancel)
{ }
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
/// <param name="eventObject"></param>
/// <param name="migrationContext"></param>
/// <param name="targetVersion"></param>
/// <param name="productName"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
internal MigrationEventArgs(IList<IMigration> eventObject, MigrationContext migrationContext, SemVersion configuredVersion, SemVersion targetVersion, string productName, bool canCancel)
: base(eventObject, canCancel)
{
MigrationContext = migrationContext;
ConfiguredSemVersion = configuredVersion;
TargetSemVersion = targetVersion;
ProductName = productName;
}
[Obsolete("Use constructor accepting UmbracoVersion instances instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, Version configuredVersion, Version targetVersion, bool canCancel)
: base(eventObject, canCancel)
{
ConfiguredSemVersion = new SemVersion(configuredVersion);
TargetSemVersion = new SemVersion(targetVersion);
}
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
@@ -66,15 +39,12 @@ namespace Umbraco.Core.Events
/// <param name="targetVersion"></param>
/// <param name="canCancel"></param>
/// <param name="configuredVersion"></param>
[Obsolete("Use constructor accepting a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
internal MigrationEventArgs(IList<IMigration> eventObject, MigrationContext migrationContext, SemVersion configuredVersion, SemVersion targetVersion, bool canCancel)
: base(eventObject, canCancel)
{
MigrationContext = migrationContext;
ConfiguredSemVersion = configuredVersion;
TargetSemVersion = targetVersion;
ProductName = GlobalSettings.UmbracoMigrationName;
}
/// <summary>
@@ -83,28 +53,21 @@ namespace Umbraco.Core.Events
/// <param name="eventObject"></param>
/// <param name="configuredVersion"></param>
/// <param name="targetVersion"></param>
/// <param name="productName"></param>
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion, string productName)
: this(eventObject, null, configuredVersion, targetVersion, productName, false)
{ }
/// <summary>
/// Constructor accepting multiple migrations that are used in the migration runner
/// </summary>
/// <param name="eventObject"></param>
/// <param name="configuredVersion"></param>
/// <param name="targetVersion"></param>
[Obsolete("Use constructor accepting a product name instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, SemVersion configuredVersion, SemVersion targetVersion)
: this(eventObject, null, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName, false)
{ }
: base(eventObject)
{
ConfiguredSemVersion = configuredVersion;
TargetSemVersion = targetVersion;
}
[Obsolete("Use constructor accepting SemVersion instances and a product name instead.")]
[Obsolete("Use constructor accepting UmbracoVersion instances instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public MigrationEventArgs(IList<IMigration> eventObject, Version configuredVersion, Version targetVersion)
: this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), GlobalSettings.UmbracoMigrationName, false)
{ }
: base(eventObject)
{
ConfiguredSemVersion = new SemVersion(configuredVersion);
TargetSemVersion = new SemVersion(targetVersion);
}
/// <summary>
/// Returns all migrations that were used in the migration runner
@@ -132,8 +95,6 @@ namespace Umbraco.Core.Events
public SemVersion TargetSemVersion { get; private set; }
public string ProductName { get; private set; }
internal MigrationContext MigrationContext { get; private set; }
}
}
+1 -10
View File
@@ -69,16 +69,7 @@ namespace Umbraco.Core.IO
}
}
public static string AppCode
{
get
{
//NOTE: this is not configurable and shouldn't need to be
return "~/App_Code";
}
}
public static string AppPlugins
public static string AppPlugins
{
get
{
@@ -1,21 +1,20 @@
using System;
using log4net.Appender;
using log4net.Core;
using log4net.Util;
using System;
using System.Runtime.Remoting.Messaging;
namespace Umbraco.Core.Logging
{
/// <summary>
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
/// </summary>
/// <remarks>
/// Based on https://github.com/cjbhaines/Log4Net.Async
/// </remarks>
public abstract class AsyncForwardingAppenderBase : ForwardingAppender
{
#region Private Members
private const FixFlags DefaultFixFlags = FixFlags.Partial;
private FixFlags fixFlags = DefaultFixFlags;
private LoggingEventHelper loggingEventHelper;
private FixFlags _fixFlags = DefaultFixFlags;
private LoggingEventHelper _loggingEventHelper;
#endregion Private Members
@@ -23,25 +22,10 @@ namespace Umbraco.Core.Logging
public FixFlags Fix
{
get { return fixFlags; }
get { return _fixFlags; }
set { SetFixFlags(value); }
}
/// <summary>
/// Returns HttpContext.Current
/// </summary>
protected internal object HttpContext
{
get
{
return CallContext.HostContext;
}
set
{
CallContext.HostContext = value;
}
}
/// <summary>
/// The logger name that will be used for logging internal errors.
/// </summary>
@@ -54,7 +38,7 @@ namespace Umbraco.Core.Logging
public override void ActivateOptions()
{
base.ActivateOptions();
loggingEventHelper = new LoggingEventHelper(InternalLoggerName, DefaultFixFlags);
_loggingEventHelper = new LoggingEventHelper(InternalLoggerName, DefaultFixFlags);
InitializeAppenders();
}
@@ -68,10 +52,10 @@ namespace Umbraco.Core.Logging
private void SetFixFlags(FixFlags newFixFlags)
{
if (newFixFlags != fixFlags)
if (newFixFlags != _fixFlags)
{
loggingEventHelper.Fix = newFixFlags;
fixFlags = newFixFlags;
_loggingEventHelper.Fix = newFixFlags;
_fixFlags = newFixFlags;
InitializeAppenders();
}
}
@@ -100,7 +84,7 @@ namespace Umbraco.Core.Logging
protected void ForwardInternalError(string message, Exception exception, Type thisType)
{
LogLog.Error(thisType, message, exception);
var loggingEvent = loggingEventHelper.CreateLoggingEvent(Level.Error, message, exception);
var loggingEvent = _loggingEventHelper.CreateLoggingEvent(Level.Error, message, exception);
ForwardLoggingEvent(loggingEvent, thisType);
}
@@ -1,7 +1,6 @@
using log4net.Core;
using log4net.Util;
using System;
using System.ComponentModel;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Threading;
@@ -13,11 +12,7 @@ namespace Umbraco.Core.Logging
/// <summary>
/// Based on https://github.com/cjbhaines/Log4Net.Async
/// which is based on code by Chris Haines http://cjbhaines.wordpress.com/2012/02/13/asynchronous-log4net-appenders/
/// This is an old/deprecated logger and has been superceded by ParallelForwardingAppender which is included in Umbraco and
/// also by AsyncForwardingAppender in the Log4Net.Async library.
/// </summary>
[Obsolete("This is superceded by the ParallelForwardingAppender, this will be removed in v8")]
[EditorBrowsable(EditorBrowsableState.Never)]
public class AsynchronousRollingFileAppender : RollingFileAppender
{
private RingBuffer<LoggingEvent> pendingAppends;
@@ -203,4 +198,79 @@ namespace Umbraco.Core.Logging
}
}
internal interface IQueue<T>
{
void Enqueue(T item);
bool TryDequeue(out T ret);
}
internal class RingBuffer<T> : IQueue<T>
{
private readonly object lockObject = new object();
private readonly T[] buffer;
private readonly int size;
private int readIndex = 0;
private int writeIndex = 0;
private bool bufferFull = false;
public int Size { get { return size; } }
public event Action<object, EventArgs> BufferOverflow;
public RingBuffer(int size)
{
this.size = size;
buffer = new T[size];
}
public void Enqueue(T item)
{
var bufferWasFull = false;
lock (lockObject)
{
buffer[writeIndex] = item;
writeIndex = (++writeIndex) % size;
if (bufferFull)
{
bufferWasFull = true;
readIndex = writeIndex;
}
else if (writeIndex == readIndex)
{
bufferFull = true;
}
}
if (bufferWasFull)
{
if (BufferOverflow != null)
{
BufferOverflow(this, EventArgs.Empty);
}
}
}
public bool TryDequeue(out T ret)
{
if (readIndex == writeIndex && !bufferFull)
{
ret = default(T);
return false;
}
lock (lockObject)
{
if (readIndex == writeIndex && !bufferFull)
{
ret = default(T);
return false;
}
ret = buffer[readIndex];
buffer[readIndex] = default(T);
readIndex = (++readIndex) % size;
bufferFull = false;
return true;
}
}
}
}
-12
View File
@@ -1,12 +0,0 @@
namespace Umbraco.Core.Logging
{
/// <summary>
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
/// </summary>
/// <typeparam name="T"></typeparam>
internal interface IQueue<T>
{
void Enqueue(T item);
bool TryDequeue(out T ret);
}
}
@@ -1,46 +0,0 @@
namespace Umbraco.Core.Logging
{
using System;
using System.Runtime.CompilerServices;
using ImageProcessor.Common.Exceptions;
/// <summary>
/// A logger for explicitly logging ImageProcessor exceptions.
/// <remarks>
/// Creating this logger is enough for ImageProcessor to find and replace its in-built debug logger
/// without any additional configuration required. This class currently has to be public in order
/// to do so.
/// </remarks>
/// </summary>
public sealed class ImageProcessorLogger : ImageProcessor.Common.Exceptions.ILogger
{
/// <summary>
/// Logs the specified message as an error.
/// </summary>
/// <typeparam name="T">The type calling the logger.</typeparam>
/// <param name="text">The message to log.</param>
/// <param name="callerName">The property or method name calling the log.</param>
/// <param name="lineNumber">The line number where the method is called.</param>
public void Log<T>(string text, [CallerMemberName] string callerName = null, [CallerLineNumber] int lineNumber = 0)
{
// Using LogHelper since the ImageProcessor logger expects a parameterless constructor.
var message = string.Format("{0} {1} : {2}", callerName, lineNumber, text);
LogHelper.Error<T>(string.Empty, new ImageProcessingException(message));
}
/// <summary>
/// Logs the specified message as an error.
/// </summary>
/// <param name="type">The type calling the logger.</param>
/// <param name="text">The message to log.</param>
/// <param name="callerName">The property or method name calling the log.</param>
/// <param name="lineNumber">The line number where the method is called.</param>
public void Log(Type type, string text, [CallerMemberName] string callerName = null, [CallerLineNumber] int lineNumber = 0)
{
// Using LogHelper since the ImageProcessor logger expects a parameterless constructor.
var message = string.Format("{0} {1} : {2}", callerName, lineNumber, text);
LogHelper.Error(type, string.Empty, new ImageProcessingException(message));
}
}
}
@@ -3,18 +3,15 @@ using log4net.Core;
namespace Umbraco.Core.Logging
{
/// <remarks>
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
/// Based on https://github.com/cjbhaines/Log4Net.Async
/// </remarks>
internal sealed class LoggingEventContext
internal class LoggingEventContext
{
public LoggingEventContext(LoggingEvent loggingEvent, object httpContext)
public LoggingEventContext(LoggingEvent loggingEvent)
{
LoggingEvent = loggingEvent;
HttpContext = httpContext;
}
public LoggingEvent LoggingEvent { get; set; }
public object HttpContext { get; set; }
}
}
@@ -4,9 +4,9 @@ using log4net.Core;
namespace Umbraco.Core.Logging
{
/// <remarks>
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
/// Based on https://github.com/cjbhaines/Log4Net.Async
/// </remarks>
internal sealed class LoggingEventHelper
internal class LoggingEventHelper
{
// needs to be a seperate class so that location is determined correctly by log4net when required
@@ -23,10 +23,8 @@ namespace Umbraco.Core.Logging
public LoggingEvent CreateLoggingEvent(Level level, string message, Exception exception)
{
var loggingEvent = new LoggingEvent(HelperType, null, loggerName, level, message, exception)
{
Fix = Fix
};
var loggingEvent = new LoggingEvent(HelperType, null, loggerName, level, message, exception);
loggingEvent.Fix = Fix;
return loggingEvent;
}
}
@@ -1,9 +1,9 @@
using log4net.Core;
using log4net.Util;
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using log4net.Core;
using log4net.Util;
namespace Umbraco.Core.Logging
{
@@ -11,7 +11,7 @@ namespace Umbraco.Core.Logging
/// An asynchronous appender based on <see cref="BlockingCollection{T}"/>
/// </summary>
/// <remarks>
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
/// Based on https://github.com/cjbhaines/Log4Net.Async
/// </remarks>
public class ParallelForwardingAppender : AsyncForwardingAppenderBase, IDisposable
{
@@ -22,11 +22,11 @@ namespace Umbraco.Core.Logging
private CancellationTokenSource _loggingCancelationTokenSource;
private CancellationToken _loggingCancelationToken;
private Task _loggingTask;
private Double _shutdownFlushTimeout = 2;
private TimeSpan _shutdownFlushTimespan = TimeSpan.FromSeconds(2);
private Double _shutdownFlushTimeout = 1;
private TimeSpan _shutdownFlushTimespan = TimeSpan.FromSeconds(1);
private static readonly Type ThisType = typeof(ParallelForwardingAppender);
private volatile bool shutDownRequested;
private int? bufferSize = DefaultBufferSize;
private volatile bool _shutDownRequested;
private int? _bufferSize = DefaultBufferSize;
#endregion Private Members
@@ -37,8 +37,8 @@ namespace Umbraco.Core.Logging
/// </summary>
public override int? BufferSize
{
get { return bufferSize; }
set { bufferSize = value; }
get { return _bufferSize; }
set { _bufferSize = value; }
}
public int BufferEntryCount
@@ -67,12 +67,7 @@ namespace Umbraco.Core.Logging
protected override string InternalLoggerName
{
get
{
{
return "ParallelForwardingAppender";
}
}
get { return "ParallelForwardingAppender"; }
}
#endregion Properties
@@ -88,7 +83,7 @@ namespace Umbraco.Core.Logging
private void StartForwarding()
{
if (shutDownRequested)
if (_shutDownRequested)
{
return;
}
@@ -116,7 +111,7 @@ namespace Umbraco.Core.Logging
private void CompleteSubscriberTask()
{
shutDownRequested = true;
_shutDownRequested = true;
if (_loggingEvents == null || _loggingEvents.IsAddingCompleted)
{
return;
@@ -159,7 +154,7 @@ namespace Umbraco.Core.Logging
loggingEvent.Fix = Fix;
//In the case where blocking on a full collection, and the task is subsequently completed, the cancellation token
//will prevent the entry from attempting to add to the completed collection which would result in an exception.
_loggingEvents.Add(new LoggingEventContext(loggingEvent, HttpContext), _loggingCancelationToken);
_loggingEvents.Add(new LoggingEventContext(loggingEvent), _loggingCancelationToken);
}
protected override void Append(LoggingEvent[] loggingEvents)
@@ -192,7 +187,6 @@ namespace Umbraco.Core.Logging
//This call blocks until an item is available or until adding is completed
foreach (var entry in _loggingEvents.GetConsumingEnumerable(_loggingCancelationToken))
{
HttpContext = entry.HttpContext;
ForwardLoggingEvent(entry.LoggingEvent, ThisType);
}
}
-78
View File
@@ -1,78 +0,0 @@
using System;
namespace Umbraco.Core.Logging
{
/// <summary>
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
/// </summary>
/// <typeparam name="T"></typeparam>
internal sealed class RingBuffer<T> : IQueue<T>
{
private readonly object lockObject = new object();
private readonly T[] buffer;
private readonly int size;
private int readIndex = 0;
private int writeIndex = 0;
private bool bufferFull = false;
public int Size { get { return size; } }
public event Action<object, EventArgs> BufferOverflow;
public RingBuffer(int size)
{
this.size = size;
buffer = new T[size];
}
public void Enqueue(T item)
{
var bufferWasFull = false;
lock (lockObject)
{
buffer[writeIndex] = item;
writeIndex = (++writeIndex) % size;
if (bufferFull)
{
bufferWasFull = true;
readIndex = writeIndex;
}
else if (writeIndex == readIndex)
{
bufferFull = true;
}
}
if (bufferWasFull)
{
if (BufferOverflow != null)
{
BufferOverflow(this, EventArgs.Empty);
}
}
}
public bool TryDequeue(out T ret)
{
if (readIndex == writeIndex && !bufferFull)
{
ret = default(T);
return false;
}
lock (lockObject)
{
if (readIndex == writeIndex && !bufferFull)
{
ret = default(T);
return false;
}
ret = buffer[readIndex];
buffer[readIndex] = default(T);
readIndex = (++readIndex) % size;
bufferFull = false;
return true;
}
}
}
}
+72 -23
View File
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
@@ -76,19 +75,14 @@ namespace Umbraco.Core.Models
_contentType = contentType;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo TemplateSelector = ExpressionHelper.GetPropertyInfo<Content, ITemplate>(x => x.Template);
public readonly PropertyInfo PublishedSelector = ExpressionHelper.GetPropertyInfo<Content, bool>(x => x.Published);
public readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo<Content, string>(x => x.Language);
public readonly PropertyInfo ReleaseDateSelector = ExpressionHelper.GetPropertyInfo<Content, DateTime?>(x => x.ReleaseDate);
public readonly PropertyInfo ExpireDateSelector = ExpressionHelper.GetPropertyInfo<Content, DateTime?>(x => x.ExpireDate);
public readonly PropertyInfo WriterSelector = ExpressionHelper.GetPropertyInfo<Content, int>(x => x.WriterId);
public readonly PropertyInfo NodeNameSelector = ExpressionHelper.GetPropertyInfo<Content, string>(x => x.NodeName);
public readonly PropertyInfo PermissionsChangedSelector = ExpressionHelper.GetPropertyInfo<Content, bool>(x => x.PermissionsChanged);
}
private static readonly PropertyInfo TemplateSelector = ExpressionHelper.GetPropertyInfo<Content, ITemplate>(x => x.Template);
private static readonly PropertyInfo PublishedSelector = ExpressionHelper.GetPropertyInfo<Content, bool>(x => x.Published);
private static readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo<Content, string>(x => x.Language);
private static readonly PropertyInfo ReleaseDateSelector = ExpressionHelper.GetPropertyInfo<Content, DateTime?>(x => x.ReleaseDate);
private static readonly PropertyInfo ExpireDateSelector = ExpressionHelper.GetPropertyInfo<Content, DateTime?>(x => x.ExpireDate);
private static readonly PropertyInfo WriterSelector = ExpressionHelper.GetPropertyInfo<Content, int>(x => x.WriterId);
private static readonly PropertyInfo NodeNameSelector = ExpressionHelper.GetPropertyInfo<Content, string>(x => x.NodeName);
private static readonly PropertyInfo PermissionsChangedSelector = ExpressionHelper.GetPropertyInfo<Content, bool>(x => x.PermissionsChanged);
/// <summary>
/// Gets or sets the template used by the Content.
@@ -102,7 +96,14 @@ namespace Umbraco.Core.Models
public virtual ITemplate Template
{
get { return _template; }
set { SetPropertyValueAndDetectChanges(value, ref _template, Ps.Value.TemplateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_template = value;
return _template;
}, _template, TemplateSelector);
}
}
/// <summary>
@@ -140,18 +141,31 @@ namespace Umbraco.Core.Models
public bool Published
{
get { return _published; }
internal set { SetPropertyValueAndDetectChanges(value, ref _published, Ps.Value.PublishedSelector); }
internal set
{
SetPropertyValueAndDetectChanges(o =>
{
_published = value;
return _published;
}, _published, PublishedSelector);
}
}
/// <summary>
/// Language of the data contained within this Content object.
/// </summary>
[Obsolete("This is not used and will be removed from the codebase in future versions")]
[EditorBrowsable(EditorBrowsableState.Never)]
public string Language
{
get { return _language; }
set { SetPropertyValueAndDetectChanges(value, ref _language, Ps.Value.LanguageSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_language = value;
return _language;
}, _language, LanguageSelector);
}
}
/// <summary>
@@ -161,7 +175,14 @@ namespace Umbraco.Core.Models
public DateTime? ReleaseDate
{
get { return _releaseDate; }
set { SetPropertyValueAndDetectChanges(value, ref _releaseDate, Ps.Value.ReleaseDateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_releaseDate = value;
return _releaseDate;
}, _releaseDate, ReleaseDateSelector);
}
}
/// <summary>
@@ -171,7 +192,14 @@ namespace Umbraco.Core.Models
public DateTime? ExpireDate
{
get { return _expireDate; }
set { SetPropertyValueAndDetectChanges(value, ref _expireDate, Ps.Value.ExpireDateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_expireDate = value;
return _expireDate;
}, _expireDate, ExpireDateSelector);
}
}
/// <summary>
@@ -181,7 +209,14 @@ namespace Umbraco.Core.Models
public virtual int WriterId
{
get { return _writer; }
set { SetPropertyValueAndDetectChanges(value, ref _writer, Ps.Value.WriterSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_writer = value;
return _writer;
}, _writer, WriterSelector);
}
}
/// <summary>
@@ -194,7 +229,14 @@ namespace Umbraco.Core.Models
internal string NodeName
{
get { return _nodeName; }
set { SetPropertyValueAndDetectChanges(value, ref _nodeName, Ps.Value.NodeNameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_nodeName = value;
return _nodeName;
}, _nodeName, NodeNameSelector);
}
}
/// <summary>
@@ -204,7 +246,14 @@ namespace Umbraco.Core.Models
internal bool PermissionsChanged
{
get { return _permissionsChanged; }
set { SetPropertyValueAndDetectChanges(value, ref _permissionsChanged, Ps.Value.PermissionsChangedSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_permissionsChanged = value;
return _permissionsChanged;
}, _permissionsChanged, PermissionsChangedSelector);
}
}
/// <summary>
+67 -23
View File
@@ -81,24 +81,19 @@ namespace Umbraco.Core.Models
_additionalData = new Dictionary<string, object>();
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<ContentBase, string>(x => x.Name);
public readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.ParentId);
public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.SortOrder);
public readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.Level);
public readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<ContentBase, string>(x => x.Path);
public readonly PropertyInfo CreatorIdSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.CreatorId);
public readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo<ContentBase, bool>(x => x.Trashed);
public readonly PropertyInfo DefaultContentTypeIdSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.ContentTypeId);
public readonly PropertyInfo PropertyCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentBase, PropertyCollection>(x => x.Properties);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<ContentBase, string>(x => x.Name);
private static readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.ParentId);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.SortOrder);
private static readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.Level);
private static readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<ContentBase, string>(x => x.Path);
private static readonly PropertyInfo CreatorIdSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.CreatorId);
private static readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo<ContentBase, bool>(x => x.Trashed);
private static readonly PropertyInfo DefaultContentTypeIdSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.ContentTypeId);
private readonly static PropertyInfo PropertyCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentBase, PropertyCollection>(x => x.Properties);
protected void PropertiesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertyCollectionSelector);
OnPropertyChanged(PropertyCollectionSelector);
}
/// <summary>
@@ -119,7 +114,7 @@ namespace Umbraco.Core.Models
set
{
_parentId = new Lazy<int>(() => value);
OnPropertyChanged(Ps.Value.ParentIdSelector);
OnPropertyChanged(ParentIdSelector);
}
}
@@ -130,7 +125,14 @@ namespace Umbraco.Core.Models
public virtual string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -140,7 +142,14 @@ namespace Umbraco.Core.Models
public virtual int SortOrder
{
get { return _sortOrder; }
set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
@@ -150,7 +159,14 @@ namespace Umbraco.Core.Models
public virtual int Level
{
get { return _level; }
set { SetPropertyValueAndDetectChanges(value, ref _level, Ps.Value.LevelSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_level = value;
return _level;
}, _level, LevelSelector);
}
}
/// <summary>
@@ -160,7 +176,14 @@ namespace Umbraco.Core.Models
public virtual string Path //Setting this value should be handled by the class not the user
{
get { return _path; }
set { SetPropertyValueAndDetectChanges(value, ref _path, Ps.Value.PathSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_path = value;
return _path;
}, _path, PathSelector);
}
}
/// <summary>
@@ -170,7 +193,14 @@ namespace Umbraco.Core.Models
public virtual int CreatorId
{
get { return _creatorId; }
set { SetPropertyValueAndDetectChanges(value, ref _creatorId, Ps.Value.CreatorIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_creatorId = value;
return _creatorId;
}, _creatorId, CreatorIdSelector);
}
}
/// <summary>
@@ -182,7 +212,14 @@ namespace Umbraco.Core.Models
public virtual bool Trashed //Setting this value should be handled by the class not the user
{
get { return _trashed; }
internal set { SetPropertyValueAndDetectChanges(value, ref _trashed, Ps.Value.TrashedSelector); }
internal set
{
SetPropertyValueAndDetectChanges(o =>
{
_trashed = value;
return _trashed;
}, _trashed, TrashedSelector);
}
}
/// <summary>
@@ -207,7 +244,14 @@ namespace Umbraco.Core.Models
}
return _contentTypeId;
}
protected set { SetPropertyValueAndDetectChanges(value, ref _contentTypeId, Ps.Value.DefaultContentTypeIdSelector); }
protected set
{
SetPropertyValueAndDetectChanges(o =>
{
_contentTypeId = value;
return _contentTypeId;
}, _contentTypeId, DefaultContentTypeIdSelector);
}
}
/// <summary>
+15 -9
View File
@@ -48,13 +48,8 @@ namespace Umbraco.Core.Models
_allowedTemplates = new List<ITemplate>();
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo DefaultTemplateSelector = ExpressionHelper.GetPropertyInfo<ContentType, int>(x => x.DefaultTemplateId);
public readonly PropertyInfo AllowedTemplatesSelector = ExpressionHelper.GetPropertyInfo<ContentType, IEnumerable<ITemplate>>(x => x.AllowedTemplates);
}
private static readonly PropertyInfo DefaultTemplateSelector = ExpressionHelper.GetPropertyInfo<ContentType, int>(x => x.DefaultTemplateId);
private static readonly PropertyInfo AllowedTemplatesSelector = ExpressionHelper.GetPropertyInfo<ContentType, IEnumerable<ITemplate>>(x => x.AllowedTemplates);
/// <summary>
/// Gets or sets the alias of the default Template.
@@ -75,7 +70,14 @@ namespace Umbraco.Core.Models
internal int DefaultTemplateId
{
get { return _defaultTemplate; }
set { SetPropertyValueAndDetectChanges(value, ref _defaultTemplate, Ps.Value.DefaultTemplateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_defaultTemplate = value;
return _defaultTemplate;
}, _defaultTemplate, DefaultTemplateSelector);
}
}
/// <summary>
@@ -90,7 +92,11 @@ namespace Umbraco.Core.Models
get { return _allowedTemplates; }
set
{
SetPropertyValueAndDetectChanges(value, ref _allowedTemplates, Ps.Value.AllowedTemplatesSelector,
SetPropertyValueAndDetectChanges(o =>
{
_allowedTemplates = value;
return _allowedTemplates;
}, _allowedTemplates, AllowedTemplatesSelector,
//Custom comparer for enumerable
new DelegateEqualityComparer<IEnumerable<ITemplate>>(
(templates, enumerable) => templates.UnsortedSequenceEqual(enumerable),
+128 -47
View File
@@ -67,38 +67,33 @@ namespace Umbraco.Core.Models
_additionalData = new Dictionary<string, object>();
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Name);
public readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.ParentId);
public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.SortOrder);
public readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.Level);
public readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Path);
public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Alias);
public readonly PropertyInfo DescriptionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Description);
public readonly PropertyInfo IconSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Icon);
public readonly PropertyInfo ThumbnailSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Thumbnail);
public readonly PropertyInfo CreatorIdSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.CreatorId);
public readonly PropertyInfo AllowedAsRootSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.AllowedAsRoot);
public readonly PropertyInfo IsContainerSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.IsContainer);
public readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.Trashed);
public readonly PropertyInfo AllowedContentTypesSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, IEnumerable<ContentTypeSort>>(x => x.AllowedContentTypes);
public readonly PropertyInfo PropertyGroupCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, PropertyGroupCollection>(x => x.PropertyGroups);
public readonly PropertyInfo PropertyTypeCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, IEnumerable<PropertyType>>(x => x.PropertyTypes);
public readonly PropertyInfo HasPropertyTypeBeenRemovedSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.HasPropertyTypeBeenRemoved);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Name);
private static readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.ParentId);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.SortOrder);
private static readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.Level);
private static readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Path);
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Alias);
private static readonly PropertyInfo DescriptionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Description);
private static readonly PropertyInfo IconSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Icon);
private static readonly PropertyInfo ThumbnailSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Thumbnail);
private static readonly PropertyInfo CreatorIdSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, int>(x => x.CreatorId);
private static readonly PropertyInfo AllowedAsRootSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.AllowedAsRoot);
private static readonly PropertyInfo IsContainerSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.IsContainer);
private static readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.Trashed);
private static readonly PropertyInfo AllowedContentTypesSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, IEnumerable<ContentTypeSort>>(x => x.AllowedContentTypes);
private static readonly PropertyInfo PropertyGroupCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, PropertyGroupCollection>(x => x.PropertyGroups);
private static readonly PropertyInfo PropertyTypeCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, IEnumerable<PropertyType>>(x => x.PropertyTypes);
private static readonly PropertyInfo HasPropertyTypeBeenRemovedSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.HasPropertyTypeBeenRemoved);
protected void PropertyGroupsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertyGroupCollectionSelector);
OnPropertyChanged(PropertyGroupCollectionSelector);
}
protected void PropertyTypesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertyTypeCollectionSelector);
OnPropertyChanged(PropertyTypeCollectionSelector);
}
/// <summary>
@@ -120,7 +115,7 @@ namespace Umbraco.Core.Models
set
{
_parentId = new Lazy<int>(() => value);
OnPropertyChanged(Ps.Value.ParentIdSelector);
OnPropertyChanged(ParentIdSelector);
}
}
@@ -131,7 +126,14 @@ namespace Umbraco.Core.Models
public virtual string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -141,7 +143,14 @@ namespace Umbraco.Core.Models
public virtual int Level //NOTE Is this relevant for a ContentType?
{
get { return _level; }
set { SetPropertyValueAndDetectChanges(value, ref _level, Ps.Value.LevelSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_level = value;
return _level;
}, _level, LevelSelector);
}
}
/// <summary>
@@ -151,7 +160,14 @@ namespace Umbraco.Core.Models
public virtual string Path //NOTE Is this relevant for a ContentType?
{
get { return _path; }
set { SetPropertyValueAndDetectChanges(value, ref _path, Ps.Value.PathSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_path = value;
return _path;
}, _path, PathSelector);
}
}
/// <summary>
@@ -163,10 +179,12 @@ namespace Umbraco.Core.Models
get { return _alias; }
set
{
SetPropertyValueAndDetectChanges(
value.ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase),
ref _alias,
Ps.Value.AliasSelector);
SetPropertyValueAndDetectChanges(o =>
{
//_alias = value.ToSafeAlias();
_alias = value.ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase);
return _alias;
}, _alias, AliasSelector);
}
}
@@ -177,7 +195,14 @@ namespace Umbraco.Core.Models
public virtual string Description
{
get { return _description; }
set { SetPropertyValueAndDetectChanges(value, ref _description, Ps.Value.DescriptionSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_description = value;
return _description;
}, _description, DescriptionSelector);
}
}
/// <summary>
@@ -187,7 +212,14 @@ namespace Umbraco.Core.Models
public virtual int SortOrder
{
get { return _sortOrder; }
set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
@@ -197,7 +229,14 @@ namespace Umbraco.Core.Models
public virtual string Icon
{
get { return _icon; }
set { SetPropertyValueAndDetectChanges(value, ref _icon, Ps.Value.IconSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_icon = value;
return _icon;
}, _icon, IconSelector);
}
}
/// <summary>
@@ -207,7 +246,14 @@ namespace Umbraco.Core.Models
public virtual string Thumbnail
{
get { return _thumbnail; }
set { SetPropertyValueAndDetectChanges(value, ref _thumbnail, Ps.Value.ThumbnailSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_thumbnail = value;
return _thumbnail;
}, _thumbnail, ThumbnailSelector);
}
}
/// <summary>
@@ -217,7 +263,14 @@ namespace Umbraco.Core.Models
public virtual int CreatorId
{
get { return _creatorId; }
set { SetPropertyValueAndDetectChanges(value, ref _creatorId, Ps.Value.CreatorIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_creatorId = value;
return _creatorId;
}, _creatorId, CreatorIdSelector);
}
}
/// <summary>
@@ -227,7 +280,14 @@ namespace Umbraco.Core.Models
public virtual bool AllowedAsRoot
{
get { return _allowedAsRoot; }
set { SetPropertyValueAndDetectChanges(value, ref _allowedAsRoot, Ps.Value.AllowedAsRootSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_allowedAsRoot = value;
return _allowedAsRoot;
}, _allowedAsRoot, AllowedAsRootSelector);
}
}
/// <summary>
@@ -240,7 +300,14 @@ namespace Umbraco.Core.Models
public virtual bool IsContainer
{
get { return _isContainer; }
set { SetPropertyValueAndDetectChanges(value, ref _isContainer, Ps.Value.IsContainerSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_isContainer = value;
return _isContainer;
}, _isContainer, IsContainerSelector);
}
}
/// <summary>
@@ -251,7 +318,14 @@ namespace Umbraco.Core.Models
public virtual bool Trashed //NOTE Is this relevant for a ContentType?
{
get { return _trashed; }
set { SetPropertyValueAndDetectChanges(value, ref _trashed, Ps.Value.TrashedSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_trashed = value;
return _trashed;
}, _trashed, TrashedSelector);
}
}
private IDictionary<string, object> _additionalData;
@@ -273,11 +347,15 @@ namespace Umbraco.Core.Models
get { return _allowedContentTypes; }
set
{
SetPropertyValueAndDetectChanges(value, ref _allowedContentTypes, Ps.Value.AllowedContentTypesSelector,
SetPropertyValueAndDetectChanges(o =>
{
_allowedContentTypes = value;
return _allowedContentTypes;
}, _allowedContentTypes, AllowedContentTypesSelector,
//Custom comparer for enumerable
new DelegateEqualityComparer<IEnumerable<ContentTypeSort>>(
(sorts, enumerable) => sorts.UnsortedSequenceEqual(enumerable),
sorts => sorts.GetHashCode()));
sorts => sorts.GetHashCode()));
}
}
@@ -340,7 +418,7 @@ namespace Umbraco.Core.Models
private set
{
_hasPropertyTypeBeenRemoved = value;
OnPropertyChanged(Ps.Value.HasPropertyTypeBeenRemovedSelector);
OnPropertyChanged(HasPropertyTypeBeenRemovedSelector);
}
}
@@ -409,8 +487,11 @@ namespace Umbraco.Core.Models
var oldPropertyGroup = PropertyGroups.FirstOrDefault(x =>
x.PropertyTypes.Any(y => y.Alias == propertyTypeAlias));
// set new group
propertyType.PropertyGroupId = newPropertyGroup == null ? null : new Lazy<int>(() => newPropertyGroup.Id, false);
// reset PropertyGroupId, which will be re-evaluated when the content type
// is saved - what is important is group.PropertyTypes - see code in
// ContentTypeBaseRepository.PersistUpdatedBaseContentType
propertyType.PropertyGroupId = new Lazy<int>(() => default(int));
propertyType.ResetDirtyProperties(); // PropertyGroupId must not be dirty
// remove from old group, if any - add to new group, if any
if (oldPropertyGroup != null)
@@ -459,13 +540,13 @@ namespace Umbraco.Core.Models
// re-assign the group's properties to no group
foreach (var property in group.PropertyTypes)
{
property.PropertyGroupId = null;
property.PropertyGroupId = new Lazy<int>(() => 0);
_propertyTypes.Add(property);
}
// actually remove the group
PropertyGroups.RemoveItem(propertyGroupName);
OnPropertyChanged(Ps.Value.PropertyGroupCollectionSelector);
OnPropertyChanged(PropertyGroupCollectionSelector);
}
/// <summary>
@@ -32,13 +32,9 @@ namespace Umbraco.Core.Models
AddContentType(parent);
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo ContentTypeCompositionSelector =
ExpressionHelper.GetPropertyInfo<ContentTypeCompositionBase, IEnumerable<IContentTypeComposition>>(x => x.ContentTypeComposition);
}
private static readonly PropertyInfo ContentTypeCompositionSelector =
ExpressionHelper.GetPropertyInfo<ContentTypeCompositionBase, IEnumerable<IContentTypeComposition>>(
x => x.ContentTypeComposition);
/// <summary>
/// Gets or sets the content types that compose this content type.
@@ -50,7 +46,7 @@ namespace Umbraco.Core.Models
set
{
_contentTypeComposition = value.ToList();
OnPropertyChanged(Ps.Value.ContentTypeCompositionSelector);
OnPropertyChanged(ContentTypeCompositionSelector);
}
}
@@ -106,7 +102,7 @@ namespace Umbraco.Core.Models
throw new InvalidCompositionException(Alias, contentType.Alias, conflictingPropertyTypeAliases.ToArray());
_contentTypeComposition.Add(contentType);
OnPropertyChanged(Ps.Value.ContentTypeCompositionSelector);
OnPropertyChanged(ContentTypeCompositionSelector);
return true;
}
return false;
@@ -132,7 +128,7 @@ namespace Umbraco.Core.Models
if (compositionIdsToRemove.Any())
RemovedContentTypeKeyTracker.AddRange(compositionIdsToRemove);
OnPropertyChanged(Ps.Value.ContentTypeCompositionSelector);
OnPropertyChanged(ContentTypeCompositionSelector);
return _contentTypeComposition.Remove(contentTypeComposition);
}
return false;
@@ -6,6 +6,10 @@ namespace Umbraco.Core.Models
/// <summary>
/// Enum of the various DbTypes for which the Property values are stored
/// </summary>
/// <remarks>
/// Object is added to support complex values from PropertyEditors,
/// but will be saved under the Ntext column.
/// </remarks>
[Serializable]
[DataContract]
public enum DataTypeDatabaseType
+73 -23
View File
@@ -65,20 +65,15 @@ namespace Umbraco.Core.Models
_additionalData = new Dictionary<string, object>();
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.Name);
public readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.ParentId);
public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.SortOrder);
public readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.Level);
public readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.Path);
public readonly PropertyInfo UserIdSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.CreatorId);
public readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, bool>(x => x.Trashed);
public readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.PropertyEditorAlias);
public readonly PropertyInfo DatabaseTypeSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, DataTypeDatabaseType>(x => x.DatabaseType);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.Name);
private static readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.ParentId);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.SortOrder);
private static readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.Level);
private static readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.Path);
private static readonly PropertyInfo UserIdSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.CreatorId);
private static readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, bool>(x => x.Trashed);
private static readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.PropertyEditorAlias);
private static readonly PropertyInfo DatabaseTypeSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, DataTypeDatabaseType>(x => x.DatabaseType);
/// <summary>
/// Gets or sets the Id of the Parent entity
@@ -88,7 +83,14 @@ namespace Umbraco.Core.Models
public int ParentId
{
get { return _parentId; }
set { SetPropertyValueAndDetectChanges(value, ref _parentId, Ps.Value.ParentIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_parentId = value;
return _parentId;
}, _parentId, ParentIdSelector);
}
}
/// <summary>
@@ -98,7 +100,14 @@ namespace Umbraco.Core.Models
public string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -108,7 +117,14 @@ namespace Umbraco.Core.Models
public int SortOrder
{
get { return _sortOrder; }
set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
@@ -118,7 +134,14 @@ namespace Umbraco.Core.Models
public int Level
{
get { return _level; }
set { SetPropertyValueAndDetectChanges(value, ref _level, Ps.Value.LevelSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_level = value;
return _level;
}, _level, LevelSelector);
}
}
/// <summary>
@@ -128,7 +151,14 @@ namespace Umbraco.Core.Models
public string Path //Setting this value should be handled by the class not the user
{
get { return _path; }
set { SetPropertyValueAndDetectChanges(value, ref _path, Ps.Value.PathSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_path = value;
return _path;
}, _path, PathSelector);
}
}
/// <summary>
@@ -138,7 +168,14 @@ namespace Umbraco.Core.Models
public int CreatorId
{
get { return _creatorId; }
set { SetPropertyValueAndDetectChanges(value, ref _creatorId, Ps.Value.UserIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_creatorId = value;
return _creatorId;
}, _creatorId, UserIdSelector);
}
}
//NOTE: SD: Why do we have this ??
@@ -152,7 +189,11 @@ namespace Umbraco.Core.Models
get { return _trashed; }
internal set
{
SetPropertyValueAndDetectChanges(value, ref _trashed, Ps.Value.TrashedSelector);
SetPropertyValueAndDetectChanges(o =>
{
_trashed = value;
return _trashed;
}, _trashed, TrashedSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
_additionalData["Trashed"] = value;
}
@@ -164,7 +205,11 @@ namespace Umbraco.Core.Models
get { return _propertyEditorAlias; }
set
{
SetPropertyValueAndDetectChanges(value, ref _propertyEditorAlias, Ps.Value.PropertyEditorAliasSelector);
SetPropertyValueAndDetectChanges(o =>
{
_propertyEditorAlias = value;
return _propertyEditorAlias;
}, _propertyEditorAlias, PropertyEditorAliasSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
_additionalData["DatabaseType"] = value;
}
@@ -200,7 +245,12 @@ namespace Umbraco.Core.Models
get { return _databaseType; }
set
{
SetPropertyValueAndDetectChanges(value, ref _databaseType, Ps.Value.DatabaseTypeSelector);
SetPropertyValueAndDetectChanges(o =>
{
_databaseType = value;
return _databaseType;
}, _databaseType, DatabaseTypeSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
_additionalData["DatabaseType"] = value;
}
+31 -18
View File
@@ -30,14 +30,9 @@ namespace Umbraco.Core.Models
_translations = new List<IDictionaryTranslation>();
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, Guid?>(x => x.ParentId);
public readonly PropertyInfo ItemKeySelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, string>(x => x.ItemKey);
public readonly PropertyInfo TranslationsSelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, IEnumerable<IDictionaryTranslation>>(x => x.Translations);
}
private static readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, Guid?>(x => x.ParentId);
private static readonly PropertyInfo ItemKeySelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, string>(x => x.ItemKey);
private static readonly PropertyInfo TranslationsSelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, IEnumerable<IDictionaryTranslation>>(x => x.Translations);
/// <summary>
/// Gets or Sets the Parent Id of the Dictionary Item
@@ -46,7 +41,14 @@ namespace Umbraco.Core.Models
public Guid? ParentId
{
get { return _parentId; }
set { SetPropertyValueAndDetectChanges(value, ref _parentId, Ps.Value.ParentIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_parentId = value;
return _parentId;
}, _parentId, ParentIdSelector);
}
}
/// <summary>
@@ -56,7 +58,14 @@ namespace Umbraco.Core.Models
public string ItemKey
{
get { return _itemKey; }
set { SetPropertyValueAndDetectChanges(value, ref _itemKey, Ps.Value.ItemKeySelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_itemKey = value;
return _itemKey;
}, _itemKey, ItemKeySelector);
}
}
/// <summary>
@@ -68,21 +77,25 @@ namespace Umbraco.Core.Models
get { return _translations; }
set
{
var asArray = value.ToArray();
//ensure the language callback is set on each translation
if (GetLanguage != null)
SetPropertyValueAndDetectChanges(o =>
{
foreach (var translation in asArray.OfType<DictionaryTranslation>())
var asArray = value.ToArray();
//ensure the language callback is set on each translation
if (GetLanguage != null)
{
translation.GetLanguage = GetLanguage;
foreach (var translation in asArray.OfType<DictionaryTranslation>())
{
translation.GetLanguage = GetLanguage;
}
}
}
SetPropertyValueAndDetectChanges(asArray, ref _translations, Ps.Value.TranslationsSelector,
_translations = asArray;
return _translations;
}, _translations, TranslationsSelector,
//Custom comparer for enumerable
new DelegateEqualityComparer<IEnumerable<IDictionaryTranslation>>(
(enumerable, translations) => enumerable.UnsortedSequenceEqual(translations),
enumerable => enumerable.GetHashCode()));
enumerable => enumerable.GetHashCode()));
}
}
}
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Models
private string _value;
//note: this will be memberwise cloned
private int _languageId;
public DictionaryTranslation(ILanguage language, string value)
{
if (language == null) throw new ArgumentNullException("language");
@@ -50,13 +50,8 @@ namespace Umbraco.Core.Models
Key = uniqueId;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo<DictionaryTranslation, ILanguage>(x => x.Language);
public readonly PropertyInfo ValueSelector = ExpressionHelper.GetPropertyInfo<DictionaryTranslation, string>(x => x.Value);
}
private static readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo<DictionaryTranslation, ILanguage>(x => x.Language);
private static readonly PropertyInfo ValueSelector = ExpressionHelper.GetPropertyInfo<DictionaryTranslation, string>(x => x.Value);
/// <summary>
/// Gets or sets the <see cref="Language"/> for the translation
@@ -84,8 +79,12 @@ namespace Umbraco.Core.Models
}
set
{
SetPropertyValueAndDetectChanges(value, ref _language, Ps.Value.LanguageSelector);
_languageId = _language == null ? -1 : _language.Id;
SetPropertyValueAndDetectChanges(o =>
{
_language = value;
_languageId = _language == null ? -1 : _language.Id;
return _language;
}, _language, LanguageSelector);
}
}
@@ -101,7 +100,14 @@ namespace Umbraco.Core.Models
public string Value
{
get { return _value; }
set { SetPropertyValueAndDetectChanges(value, ref _value, Ps.Value.ValueSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_value = value;
return _value;
}, _value, ValueSelector);
}
}
public override object DeepClone()
+57 -19
View File
@@ -23,17 +23,13 @@ namespace Umbraco.Core.Models.EntityBase
private DateTime _updateDate;
private bool _wasCancelled;
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Entity, int>(x => x.Id);
public readonly PropertyInfo KeySelector = ExpressionHelper.GetPropertyInfo<Entity, Guid>(x => x.Key);
public readonly PropertyInfo CreateDateSelector = ExpressionHelper.GetPropertyInfo<Entity, DateTime>(x => x.CreateDate);
public readonly PropertyInfo UpdateDateSelector = ExpressionHelper.GetPropertyInfo<Entity, DateTime>(x => x.UpdateDate);
public readonly PropertyInfo HasIdentitySelector = ExpressionHelper.GetPropertyInfo<Entity, bool>(x => x.HasIdentity);
public readonly PropertyInfo WasCancelledSelector = ExpressionHelper.GetPropertyInfo<Entity, bool>(x => x.WasCancelled);
}
private static readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Entity, int>(x => x.Id);
private static readonly PropertyInfo KeySelector = ExpressionHelper.GetPropertyInfo<Entity, Guid>(x => x.Key);
private static readonly PropertyInfo CreateDateSelector = ExpressionHelper.GetPropertyInfo<Entity, DateTime>(x => x.CreateDate);
private static readonly PropertyInfo UpdateDateSelector = ExpressionHelper.GetPropertyInfo<Entity, DateTime>(x => x.UpdateDate);
private static readonly PropertyInfo HasIdentitySelector = ExpressionHelper.GetPropertyInfo<Entity, bool>(x => x.HasIdentity);
private static readonly PropertyInfo WasCancelledSelector = ExpressionHelper.GetPropertyInfo<Entity, bool>(x => x.WasCancelled);
/// <summary>
/// Integer Id
@@ -41,11 +37,18 @@ namespace Umbraco.Core.Models.EntityBase
[DataMember]
public int Id
{
get { return _id; }
get
{
return _id;
}
set
{
SetPropertyValueAndDetectChanges(value, ref _id, Ps.Value.IdSelector);
HasIdentity = true; //set the has Identity
SetPropertyValueAndDetectChanges(o =>
{
_id = value;
HasIdentity = true; //set the has Identity
return _id;
}, _id, IdSelector);
}
}
@@ -64,7 +67,14 @@ namespace Umbraco.Core.Models.EntityBase
_key = Guid.NewGuid();
return _key;
}
set { SetPropertyValueAndDetectChanges(value, ref _key, Ps.Value.KeySelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_key = value;
return _key;
}, _key, KeySelector);
}
}
/// <summary>
@@ -74,7 +84,14 @@ namespace Umbraco.Core.Models.EntityBase
public DateTime CreateDate
{
get { return _createDate; }
set { SetPropertyValueAndDetectChanges(value, ref _createDate, Ps.Value.CreateDateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_createDate = value;
return _createDate;
}, _createDate, CreateDateSelector);
}
}
/// <summary>
@@ -88,7 +105,14 @@ namespace Umbraco.Core.Models.EntityBase
internal bool WasCancelled
{
get { return _wasCancelled; }
set { SetPropertyValueAndDetectChanges(value, ref _wasCancelled, Ps.Value.WasCancelledSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_wasCancelled = value;
return _wasCancelled;
}, _wasCancelled, WasCancelledSelector);
}
}
/// <summary>
@@ -98,7 +122,14 @@ namespace Umbraco.Core.Models.EntityBase
public DateTime UpdateDate
{
get { return _updateDate; }
set { SetPropertyValueAndDetectChanges(value, ref _updateDate, Ps.Value.UpdateDateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_updateDate = value;
return _updateDate;
}, _updateDate, UpdateDateSelector);
}
}
internal virtual void ResetIdentity()
@@ -135,7 +166,14 @@ namespace Umbraco.Core.Models.EntityBase
{
return _hasIdentity;
}
protected set { SetPropertyValueAndDetectChanges(value, ref _hasIdentity, Ps.Value.HasIdentitySelector); }
protected set
{
SetPropertyValueAndDetectChanges(o =>
{
_hasIdentity = value;
return _hasIdentity;
}, _hasIdentity, HasIdentitySelector);
}
}
//TODO: Make this NOT virtual or even exist really!
@@ -18,9 +18,7 @@ namespace Umbraco.Core.Models.EntityBase
//TODO: This needs to go on to ICanBeDirty http://issues.umbraco.org/issue/U4-5662
public virtual IEnumerable<string> GetDirtyProperties()
{
return _propertyChangedInfo == null
? Enumerable.Empty<string>()
: _propertyChangedInfo.Where(x => x.Value).Select(x => x.Key);
return _propertyChangedInfo.Where(x => x.Value).Select(x => x.Key);
}
private bool _changeTrackingEnabled = true;
@@ -28,12 +26,12 @@ namespace Umbraco.Core.Models.EntityBase
/// <summary>
/// Tracks the properties that have changed
/// </summary>
private IDictionary<string, bool> _propertyChangedInfo;
private IDictionary<string, bool> _propertyChangedInfo = new Dictionary<string, bool>();
/// <summary>
/// Tracks the properties that we're changed before the last commit (or last call to ResetDirtyProperties)
/// </summary>
private IDictionary<string, bool> _lastPropertyChangedInfo;
private IDictionary<string, bool> _lastPropertyChangedInfo = null;
/// <summary>
/// Property changed event
@@ -49,13 +47,12 @@ namespace Umbraco.Core.Models.EntityBase
//return if we're not tracking changes
if (_changeTrackingEnabled == false) return;
if (_propertyChangedInfo == null)
_propertyChangedInfo = new Dictionary<string, bool>();
_propertyChangedInfo[propertyInfo.Name] = true;
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyInfo.Name));
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyInfo.Name));
}
}
/// <summary>
@@ -65,7 +62,7 @@ namespace Umbraco.Core.Models.EntityBase
/// <returns>True if Property is dirty, otherwise False</returns>
public virtual bool IsPropertyDirty(string propertyName)
{
return _propertyChangedInfo != null && _propertyChangedInfo.Any(x => x.Key == propertyName);
return _propertyChangedInfo.Any(x => x.Key == propertyName);
}
/// <summary>
@@ -74,7 +71,7 @@ namespace Umbraco.Core.Models.EntityBase
/// <returns>True if entity is dirty, otherwise False</returns>
public virtual bool IsDirty()
{
return _propertyChangedInfo != null && _propertyChangedInfo.Any();
return _propertyChangedInfo.Any();
}
/// <summary>
@@ -93,7 +90,7 @@ namespace Umbraco.Core.Models.EntityBase
/// <returns>True if Property was changed, otherwise False. Returns false if the entity had not been previously changed.</returns>
public virtual bool WasPropertyDirty(string propertyName)
{
return _lastPropertyChangedInfo != null && _lastPropertyChangedInfo.Any(x => x.Key == propertyName);
return WasDirty() && _lastPropertyChangedInfo.Any(x => x.Key == propertyName);
}
/// <summary>
@@ -103,7 +100,7 @@ namespace Umbraco.Core.Models.EntityBase
{
//NOTE: We cannot .Clear() because when we memberwise clone this will be the SAME
// instance as the one on the clone, so we need to create a new instance.
_lastPropertyChangedInfo = null;
_lastPropertyChangedInfo = new Dictionary<string, bool>();
}
/// <summary>
@@ -133,29 +130,26 @@ namespace Umbraco.Core.Models.EntityBase
if (rememberPreviouslyChangedProperties)
{
//copy the changed properties to the last changed properties
if (_propertyChangedInfo != null)
{
_lastPropertyChangedInfo = _propertyChangedInfo.ToDictionary(v => v.Key, v => v.Value);
}
_lastPropertyChangedInfo = _propertyChangedInfo.ToDictionary(v => v.Key, v => v.Value);
}
//NOTE: We cannot .Clear() because when we memberwise clone this will be the SAME
// instance as the one on the clone, so we need to create a new instance.
_propertyChangedInfo = null;
_propertyChangedInfo = new Dictionary<string, bool>();
}
public void ResetChangeTrackingCollections()
protected void ResetChangeTrackingCollections()
{
_propertyChangedInfo = null;
_lastPropertyChangedInfo = null;
_propertyChangedInfo = new Dictionary<string, bool>();
_lastPropertyChangedInfo = new Dictionary<string, bool>();
}
public void DisableChangeTracking()
protected void DisableChangeTracking()
{
_changeTrackingEnabled = false;
}
public void EnableChangeTracking()
protected void EnableChangeTracking()
{
_changeTrackingEnabled = true;
}
@@ -164,61 +158,60 @@ namespace Umbraco.Core.Models.EntityBase
/// Used by inheritors to set the value of properties, this will detect if the property value actually changed and if it did
/// it will ensure that the property has a dirty flag set.
/// </summary>
/// <param name="newVal"></param>
/// <param name="origVal"></param>
/// <param name="setValue"></param>
/// <param name="value"></param>
/// <param name="propertySelector"></param>
/// <returns>returns true if the value changed</returns>
/// <remarks>
/// This is required because we don't want a property to show up as "dirty" if the value is the same. For example, when we
/// save a document type, nearly all properties are flagged as dirty just because we've 'reset' them, but they are all set
/// This is required because we don't want a property to show up as "dirty" if the value is the same. For example, when we
/// save a document type, nearly all properties are flagged as dirty just because we've 'reset' them, but they are all set
/// to the same value, so it's really not dirty.
/// </remarks>
internal void SetPropertyValueAndDetectChanges<T>(T newVal, ref T origVal, PropertyInfo propertySelector)
internal bool SetPropertyValueAndDetectChanges<T>(Func<T, T> setValue, T value, PropertyInfo propertySelector)
{
if ((typeof(T) == typeof(string) == false) && TypeHelper.IsTypeAssignableFrom<IEnumerable>(typeof(T)))
{
throw new InvalidOperationException("This method does not support IEnumerable instances. For IEnumerable instances a manual custom equality check will be required");
}
SetPropertyValueAndDetectChanges(newVal, ref origVal, propertySelector, EqualityComparer<T>.Default);
return SetPropertyValueAndDetectChanges(setValue, value, propertySelector,
new DelegateEqualityComparer<T>(
//Standard Equals comparison
(arg1, arg2) => Equals(arg1, arg2),
arg => arg.GetHashCode()));
}
/// <summary>
/// Used by inheritors to set the value of properties, this will detect if the property value actually changed and if it did
/// it will ensure that the property has a dirty flag set.
/// </summary>
/// <param name="newVal"></param>
/// <param name="origVal"></param>
/// <param name="setValue"></param>
/// <param name="value"></param>
/// <param name="propertySelector"></param>
/// <param name="comparer">The equality comparer to use</param>
/// <returns>returns true if the value changed</returns>
/// <remarks>
/// This is required because we don't want a property to show up as "dirty" if the value is the same. For example, when we
/// save a document type, nearly all properties are flagged as dirty just because we've 'reset' them, but they are all set
/// This is required because we don't want a property to show up as "dirty" if the value is the same. For example, when we
/// save a document type, nearly all properties are flagged as dirty just because we've 'reset' them, but they are all set
/// to the same value, so it's really not dirty.
/// </remarks>
internal void SetPropertyValueAndDetectChanges<T>(T newVal, ref T origVal, PropertyInfo propertySelector, IEqualityComparer<T> comparer)
internal bool SetPropertyValueAndDetectChanges<T>(Func<T, T> setValue, T value, PropertyInfo propertySelector, IEqualityComparer<T> comparer)
{
//don't track changes, just set the value
if (_changeTrackingEnabled == false)
{
//set the original value
origVal = newVal;
}
else
{
//check changed
var changed = comparer.Equals(origVal, newVal) == false;
var initVal = value;
var newVal = setValue(value);
//set the original value
origVal = newVal;
//don't track changes, just set the value (above)
if (_changeTrackingEnabled == false) return false;
//raise the event if it was changed
if (changed)
{
OnPropertyChanged(propertySelector);
}
if (comparer.Equals(initVal, newVal) == false)
{
OnPropertyChanged(propertySelector);
return true;
}
return false;
}
}
}
+12 -12
View File
@@ -33,14 +33,8 @@ namespace Umbraco.Core.Models
_content = getFileContent != null ? null : string.Empty;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo ContentSelector = ExpressionHelper.GetPropertyInfo<File, string>(x => x.Content);
public readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<File, string>(x => x.Path);
}
private static readonly PropertyInfo ContentSelector = ExpressionHelper.GetPropertyInfo<File, string>(x => x.Content);
private static readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<File, string>(x => x.Path);
private string _alias;
private string _name;
@@ -93,7 +87,11 @@ namespace Umbraco.Core.Models
_alias = null;
_name = null;
SetPropertyValueAndDetectChanges(SanitizePath(value), ref _path, Ps.Value.PathSelector);
SetPropertyValueAndDetectChanges(o =>
{
_path = SanitizePath(value);
return _path;
}, _path, PathSelector);
}
}
@@ -133,9 +131,11 @@ namespace Umbraco.Core.Models
}
set
{
SetPropertyValueAndDetectChanges(
value ?? string.Empty, // cannot set to null
ref _content, Ps.Value.ContentSelector);
SetPropertyValueAndDetectChanges(o =>
{
_content = value ?? string.Empty; // cannot set to null
return _content;
}, _content, ContentSelector);
}
}
-2
View File
@@ -1,5 +1,4 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using Umbraco.Core.Persistence.Mappers;
@@ -22,7 +21,6 @@ namespace Umbraco.Core.Models
bool Published { get; }
[Obsolete("This will be removed in future versions")]
[EditorBrowsable(EditorBrowsableState.Never)]
string Language { get; set; }
/// <summary>
+1 -7
View File
@@ -7,12 +7,6 @@ namespace Umbraco.Core.Models
/// </summary
public interface IMediaType : IContentTypeComposition
{
/// <summary>
/// Creates a deep clone of the current entity with its identity/alias and it's property identities reset
/// </summary>
/// <param name="newAlias"></param>
/// <returns></returns>
IMediaType DeepCloneWithResetIdentities(string newAlias);
}
}
-37
View File
@@ -1,37 +0,0 @@
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a redirect url.
/// </summary>
public interface IRedirectUrl : IAggregateRoot, IRememberBeingDirty
{
/// <summary>
/// Gets or sets the identifier of the content item.
/// </summary>
[DataMember]
int ContentId { get; set; }
/// <summary>
/// Gets or sets the unique key identifying the content item.
/// </summary>
[DataMember]
Guid ContentKey { get; set; }
/// <summary>
/// Gets or sets the redirect url creation date.
/// </summary>
[DataMember]
DateTime CreateDateUtc { get; set; }
/// <summary>
/// Gets or sets the redirect url route.
/// </summary>
/// <remarks>Is a proper Umbraco route eg /path/to/foo or 123/path/tofoo.</remarks>
[DataMember]
string Url { get; set; }
}
}
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Models.Identity
Culture = Configuration.GlobalSettings.DefaultUILanguage;
}
public virtual async Task<ClaimsIdentity> GenerateUserIdentityAsync(BackOfficeUserManager<BackOfficeIdentityUser> manager)
public virtual async Task<ClaimsIdentity> GenerateUserIdentityAsync(BackOfficeUserManager manager)
{
// NOTE the authenticationType must match the umbraco one
// defined in CookieAuthenticationOptions.AuthenticationType
+18 -9
View File
@@ -21,13 +21,8 @@ namespace Umbraco.Core.Models
IsoCode = isoCode;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo IsoCodeSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.IsoCode);
public readonly PropertyInfo CultureNameSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.CultureName);
}
private static readonly PropertyInfo IsoCodeSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.IsoCode);
private static readonly PropertyInfo CultureNameSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.CultureName);
/// <summary>
/// Gets or sets the Iso Code for the Language
@@ -36,7 +31,14 @@ namespace Umbraco.Core.Models
public string IsoCode
{
get { return _isoCode; }
set { SetPropertyValueAndDetectChanges(value, ref _isoCode, Ps.Value.IsoCodeSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_isoCode = value;
return _isoCode;
}, _isoCode, IsoCodeSelector);
}
}
/// <summary>
@@ -46,7 +48,14 @@ namespace Umbraco.Core.Models
public string CultureName
{
get { return _cultureName; }
set { SetPropertyValueAndDetectChanges(value, ref _cultureName, Ps.Value.CultureNameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cultureName = value;
return _cultureName;
}, _cultureName, CultureNameSelector);
}
}
/// <summary>
+102 -30
View File
@@ -114,27 +114,22 @@ namespace Umbraco.Core.Models
private List<string> _addedProperties;
private List<string> _removedProperties;
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Alias);
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Name);
public readonly PropertyInfo UseInEditorSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.UseInEditor);
public readonly PropertyInfo CacheDurationSelector = ExpressionHelper.GetPropertyInfo<Macro, int>(x => x.CacheDuration);
public readonly PropertyInfo CacheByPageSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByPage);
public readonly PropertyInfo CacheByMemberSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByMember);
public readonly PropertyInfo DontRenderSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.DontRender);
public readonly PropertyInfo ControlPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlType);
public readonly PropertyInfo ControlAssemblySelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlAssembly);
public readonly PropertyInfo ScriptPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ScriptPath);
public readonly PropertyInfo XsltPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.XsltPath);
public readonly PropertyInfo PropertiesSelector = ExpressionHelper.GetPropertyInfo<Macro, MacroPropertyCollection>(x => x.Properties);
}
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Alias);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.Name);
private static readonly PropertyInfo UseInEditorSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.UseInEditor);
private static readonly PropertyInfo CacheDurationSelector = ExpressionHelper.GetPropertyInfo<Macro, int>(x => x.CacheDuration);
private static readonly PropertyInfo CacheByPageSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByPage);
private static readonly PropertyInfo CacheByMemberSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.CacheByMember);
private static readonly PropertyInfo DontRenderSelector = ExpressionHelper.GetPropertyInfo<Macro, bool>(x => x.DontRender);
private static readonly PropertyInfo ControlPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlType);
private static readonly PropertyInfo ControlAssemblySelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ControlAssembly);
private static readonly PropertyInfo ScriptPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.ScriptPath);
private static readonly PropertyInfo XsltPathSelector = ExpressionHelper.GetPropertyInfo<Macro, string>(x => x.XsltPath);
private static readonly PropertyInfo PropertiesSelector = ExpressionHelper.GetPropertyInfo<Macro, MacroPropertyCollection>(x => x.Properties);
void PropertiesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertiesSelector);
OnPropertyChanged(PropertiesSelector);
if (e.Action == NotifyCollectionChangedAction.Add)
{
@@ -172,7 +167,7 @@ namespace Umbraco.Core.Models
/// <param name="e"></param>
void PropertyDataChanged(object sender, PropertyChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertiesSelector);
OnPropertyChanged(PropertiesSelector);
}
public override void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
@@ -209,7 +204,14 @@ namespace Umbraco.Core.Models
public string Alias
{
get { return _alias; }
set { SetPropertyValueAndDetectChanges(value.ToCleanString(CleanStringType.Alias), ref _alias, Ps.Value.AliasSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_alias = value.ToCleanString(CleanStringType.Alias);
return _alias;
}, _alias, AliasSelector);
}
}
/// <summary>
@@ -219,7 +221,14 @@ namespace Umbraco.Core.Models
public string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -229,7 +238,14 @@ namespace Umbraco.Core.Models
public bool UseInEditor
{
get { return _useInEditor; }
set { SetPropertyValueAndDetectChanges(value, ref _useInEditor, Ps.Value.UseInEditorSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_useInEditor = value;
return _useInEditor;
}, _useInEditor, UseInEditorSelector);
}
}
/// <summary>
@@ -239,7 +255,14 @@ namespace Umbraco.Core.Models
public int CacheDuration
{
get { return _cacheDuration; }
set { SetPropertyValueAndDetectChanges(value, ref _cacheDuration, Ps.Value.CacheDurationSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheDuration = value;
return _cacheDuration;
}, _cacheDuration, CacheDurationSelector);
}
}
/// <summary>
@@ -249,7 +272,14 @@ namespace Umbraco.Core.Models
public bool CacheByPage
{
get { return _cacheByPage; }
set { SetPropertyValueAndDetectChanges(value, ref _cacheByPage, Ps.Value.CacheByPageSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheByPage = value;
return _cacheByPage;
}, _cacheByPage, CacheByPageSelector);
}
}
/// <summary>
@@ -259,7 +289,14 @@ namespace Umbraco.Core.Models
public bool CacheByMember
{
get { return _cacheByMember; }
set { SetPropertyValueAndDetectChanges(value, ref _cacheByMember, Ps.Value.CacheByMemberSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cacheByMember = value;
return _cacheByMember;
}, _cacheByMember, CacheByMemberSelector);
}
}
/// <summary>
@@ -269,7 +306,14 @@ namespace Umbraco.Core.Models
public bool DontRender
{
get { return _dontRender; }
set { SetPropertyValueAndDetectChanges(value, ref _dontRender, Ps.Value.DontRenderSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_dontRender = value;
return _dontRender;
}, _dontRender, DontRenderSelector);
}
}
/// <summary>
@@ -279,7 +323,14 @@ namespace Umbraco.Core.Models
public string ControlType
{
get { return _scriptFile; }
set { SetPropertyValueAndDetectChanges(value, ref _scriptFile, Ps.Value.ControlPathSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_scriptFile = value;
return _scriptFile;
}, _scriptFile, ControlPathSelector);
}
}
/// <summary>
@@ -290,7 +341,14 @@ namespace Umbraco.Core.Models
public string ControlAssembly
{
get { return _scriptAssembly; }
set { SetPropertyValueAndDetectChanges(value, ref _scriptAssembly, Ps.Value.ControlAssemblySelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_scriptAssembly = value;
return _scriptAssembly;
}, _scriptAssembly, ControlAssemblySelector);
}
}
/// <summary>
@@ -301,7 +359,14 @@ namespace Umbraco.Core.Models
public string ScriptPath
{
get { return _scriptPath; }
set { SetPropertyValueAndDetectChanges(value, ref _scriptPath, Ps.Value.ScriptPathSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_scriptPath = value;
return _scriptPath;
}, _scriptPath, ScriptPathSelector);
}
}
/// <summary>
@@ -312,7 +377,14 @@ namespace Umbraco.Core.Models
public string XsltPath
{
get { return _xslt; }
set { SetPropertyValueAndDetectChanges(value, ref _xslt, Ps.Value.XsltPathSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_xslt = value;
return _xslt;
}, _xslt, XsltPathSelector);
}
}
/// <summary>
+52 -18
View File
@@ -72,16 +72,11 @@ namespace Umbraco.Core.Models
private int _id;
private string _editorAlias;
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Alias);
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Name);
public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, int>(x => x.SortOrder);
public readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Entity, int>(x => x.Id);
public readonly PropertyInfo PropertyTypeSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.EditorAlias);
}
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Alias);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.Name);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, int>(x => x.SortOrder);
private static readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Entity, int>(x => x.Id);
private static readonly PropertyInfo PropertyTypeSelector = ExpressionHelper.GetPropertyInfo<MacroProperty, string>(x => x.EditorAlias);
/// <summary>
/// Gets or sets the Alias of the Property
@@ -90,7 +85,14 @@ namespace Umbraco.Core.Models
public int Id
{
get { return _id; }
set { SetPropertyValueAndDetectChanges(value, ref _id, Ps.Value.IdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_id = value;
return _alias;
}, _alias, IdSelector);
}
}
/// <summary>
@@ -100,7 +102,14 @@ namespace Umbraco.Core.Models
public string Alias
{
get { return _alias; }
set { SetPropertyValueAndDetectChanges(value, ref _alias, Ps.Value.AliasSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_alias = value;
return _alias;
}, _alias, AliasSelector);
}
}
/// <summary>
@@ -110,7 +119,14 @@ namespace Umbraco.Core.Models
public string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -120,7 +136,14 @@ namespace Umbraco.Core.Models
public int SortOrder
{
get { return _sortOrder; }
set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
@@ -136,10 +159,21 @@ namespace Umbraco.Core.Models
get { return _editorAlias; }
set
{
//try to get the new mapped parameter editor
var mapped = LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(value, false);
var newVal = mapped.IsNullOrWhiteSpace() == false ? mapped : value;
SetPropertyValueAndDetectChanges(newVal, ref _editorAlias, Ps.Value.PropertyTypeSelector);
SetPropertyValueAndDetectChanges(o =>
{
//try to get the new mapped parameter editor
var mapped = LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(value, false);
if (mapped.IsNullOrWhiteSpace() == false)
{
_editorAlias = mapped;
}
else
{
_editorAlias = value;
}
return _editorAlias;
}, _editorAlias, PropertyTypeSelector);
}
}
-25
View File
@@ -38,30 +38,5 @@ namespace Umbraco.Core.Models
: base(parent, alias)
{
}
/// <summary>
/// Creates a deep clone of the current entity with its identity/alias and it's property identities reset
/// </summary>
/// <returns></returns>
public IMediaType DeepCloneWithResetIdentities(string alias)
{
var clone = (MediaType)DeepClone();
clone.Alias = alias;
clone.Key = Guid.Empty;
foreach (var propertyGroup in clone.PropertyGroups)
{
propertyGroup.ResetIdentity();
propertyGroup.ResetDirtyProperties(false);
}
foreach (var propertyType in clone.PropertyTypes)
{
propertyType.ResetIdentity();
propertyType.ResetDirtyProperties(false);
}
clone.ResetIdentity();
clone.ResetDirtyProperties(false);
return clone;
}
}
}
+36 -13
View File
@@ -109,15 +109,10 @@ namespace Umbraco.Core.Models
IsApproved = true;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo UsernameSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Username);
public readonly PropertyInfo EmailSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Email);
public readonly PropertyInfo PasswordSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.RawPasswordValue);
public readonly PropertyInfo ProviderUserKeySelector = ExpressionHelper.GetPropertyInfo<Member, object>(x => x.ProviderUserKey);
}
private static readonly PropertyInfo UsernameSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Username);
private static readonly PropertyInfo EmailSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.Email);
private static readonly PropertyInfo PasswordSelector = ExpressionHelper.GetPropertyInfo<Member, string>(x => x.RawPasswordValue);
private static readonly PropertyInfo ProviderUserKeySelector = ExpressionHelper.GetPropertyInfo<Member, object>(x => x.ProviderUserKey);
/// <summary>
/// Gets or sets the Username
@@ -126,7 +121,14 @@ namespace Umbraco.Core.Models
public string Username
{
get { return _username; }
set { SetPropertyValueAndDetectChanges(value, ref _username, Ps.Value.UsernameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_username = value;
return _username;
}, _username, UsernameSelector);
}
}
/// <summary>
@@ -136,7 +138,14 @@ namespace Umbraco.Core.Models
public string Email
{
get { return _email; }
set { SetPropertyValueAndDetectChanges(value, ref _email, Ps.Value.EmailSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_email = value;
return _email;
}, _email, EmailSelector);
}
}
/// <summary>
@@ -146,7 +155,14 @@ namespace Umbraco.Core.Models
public string RawPasswordValue
{
get { return _rawPasswordValue; }
set { SetPropertyValueAndDetectChanges(value, ref _rawPasswordValue, Ps.Value.PasswordSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_rawPasswordValue = value;
return _rawPasswordValue;
}, _rawPasswordValue, PasswordSelector);
}
}
/// <summary>
@@ -474,7 +490,14 @@ namespace Umbraco.Core.Models
{
return _providerUserKey;
}
set { SetPropertyValueAndDetectChanges(value, ref _providerUserKey, Ps.Value.ProviderUserKeySelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_providerUserKey = value;
return _providerUserKey;
}, _providerUserKey, ProviderUserKeySelector);
}
}
+21 -15
View File
@@ -21,13 +21,8 @@ namespace Umbraco.Core.Models
private string _name;
private int _creatorId;
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MemberGroup, string>(x => x.Name);
public readonly PropertyInfo CreatorIdSelector = ExpressionHelper.GetPropertyInfo<MemberGroup, int>(x => x.CreatorId);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MemberGroup, string>(x => x.Name);
private static readonly PropertyInfo CreatorIdSelector = ExpressionHelper.GetPropertyInfo<MemberGroup, int>(x => x.CreatorId);
[DataMember]
public string Name
@@ -35,22 +30,33 @@ namespace Umbraco.Core.Models
get { return _name; }
set
{
if (_name != value)
SetPropertyValueAndDetectChanges(o =>
{
//if the name has changed, add the value to the additional data,
//this is required purely for event handlers to know the previous name of the group
//so we can keep the public access up to date.
AdditionalData["previousName"] = _name;
}
if (_name != value)
{
//if the name has changed, add the value to the additional data,
//this is required purely for event handlers to know the previous name of the group
//so we can keep the public access up to date.
AdditionalData["previousName"] = _name;
}
SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector);
_name = value;
return _name;
}, _name, NameSelector);
}
}
public int CreatorId
{
get { return _creatorId; }
set { SetPropertyValueAndDetectChanges(value, ref _creatorId, Ps.Value.CreatorIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_creatorId = value;
return _creatorId;
}, _creatorId, CreatorIdSelector);
}
}
public IDictionary<string, object> AdditionalData { get; private set; }
+8 -11
View File
@@ -30,12 +30,7 @@ namespace Umbraco.Core.Models
MemberTypePropertyTypes = new Dictionary<string, MemberTypePropertyProfileAccess>();
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<MemberType, string>(x => x.Alias);
}
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<MemberType, string>(x => x.Alias);
/// <summary>
/// The Alias of the ContentType
@@ -55,11 +50,13 @@ namespace Umbraco.Core.Models
// .ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase)
// Need to ask Stephen
var newVal = value == "_umbracoSystemDefaultProtectType"
? value
: (value == null ? string.Empty : value.ToSafeAlias());
SetPropertyValueAndDetectChanges(newVal, ref _alias, Ps.Value.AliasSelector);
SetPropertyValueAndDetectChanges(o =>
{
_alias = value == "_umbracoSystemDefaultProtectType"
? value
: (value == null ? string.Empty : value.ToSafeAlias() );
return _alias;
}, _alias, AliasSelector);
}
}
+153 -42
View File
@@ -77,32 +77,27 @@ namespace Umbraco.Core.Models.Membership
private bool _defaultToLiveEditing;
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private static readonly PropertyInfo FailedPasswordAttemptsSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.FailedPasswordAttempts);
private static readonly PropertyInfo LastLockoutDateSelector = ExpressionHelper.GetPropertyInfo<User, DateTime>(x => x.LastLockoutDate);
private static readonly PropertyInfo LastLoginDateSelector = ExpressionHelper.GetPropertyInfo<User, DateTime>(x => x.LastLoginDate);
private static readonly PropertyInfo LastPasswordChangeDateSelector = ExpressionHelper.GetPropertyInfo<User, DateTime>(x => x.LastPasswordChangeDate);
private class PropertySelectors
{
public readonly PropertyInfo FailedPasswordAttemptsSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.FailedPasswordAttempts);
public readonly PropertyInfo LastLockoutDateSelector = ExpressionHelper.GetPropertyInfo<User, DateTime>(x => x.LastLockoutDate);
public readonly PropertyInfo LastLoginDateSelector = ExpressionHelper.GetPropertyInfo<User, DateTime>(x => x.LastLoginDate);
public readonly PropertyInfo LastPasswordChangeDateSelector = ExpressionHelper.GetPropertyInfo<User, DateTime>(x => x.LastPasswordChangeDate);
private static readonly PropertyInfo SecurityStampSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.SecurityStamp);
private static readonly PropertyInfo SessionTimeoutSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.SessionTimeout);
private static readonly PropertyInfo StartContentIdSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.StartContentId);
private static readonly PropertyInfo StartMediaIdSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.StartMediaId);
private static readonly PropertyInfo AllowedSectionsSelector = ExpressionHelper.GetPropertyInfo<User, IEnumerable<string>>(x => x.AllowedSections);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Name);
private static readonly PropertyInfo UsernameSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Username);
private static readonly PropertyInfo EmailSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Email);
private static readonly PropertyInfo PasswordSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.RawPasswordValue);
private static readonly PropertyInfo IsLockedOutSelector = ExpressionHelper.GetPropertyInfo<User, bool>(x => x.IsLockedOut);
private static readonly PropertyInfo IsApprovedSelector = ExpressionHelper.GetPropertyInfo<User, bool>(x => x.IsApproved);
private static readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Language);
public readonly PropertyInfo SecurityStampSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.SecurityStamp);
public readonly PropertyInfo SessionTimeoutSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.SessionTimeout);
public readonly PropertyInfo StartContentIdSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.StartContentId);
public readonly PropertyInfo StartMediaIdSelector = ExpressionHelper.GetPropertyInfo<User, int>(x => x.StartMediaId);
public readonly PropertyInfo AllowedSectionsSelector = ExpressionHelper.GetPropertyInfo<User, IEnumerable<string>>(x => x.AllowedSections);
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Name);
public readonly PropertyInfo UsernameSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Username);
public readonly PropertyInfo EmailSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Email);
public readonly PropertyInfo PasswordSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.RawPasswordValue);
public readonly PropertyInfo IsLockedOutSelector = ExpressionHelper.GetPropertyInfo<User, bool>(x => x.IsLockedOut);
public readonly PropertyInfo IsApprovedSelector = ExpressionHelper.GetPropertyInfo<User, bool>(x => x.IsApproved);
public readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo<User, string>(x => x.Language);
public readonly PropertyInfo DefaultToLiveEditingSelector = ExpressionHelper.GetPropertyInfo<User, bool>(x => x.DefaultToLiveEditing);
public readonly PropertyInfo UserTypeSelector = ExpressionHelper.GetPropertyInfo<User, IUserType>(x => x.UserType);
}
private static readonly PropertyInfo DefaultToLiveEditingSelector = ExpressionHelper.GetPropertyInfo<User, bool>(x => x.DefaultToLiveEditing);
private static readonly PropertyInfo UserTypeSelector = ExpressionHelper.GetPropertyInfo<User, IUserType>(x => x.UserType);
#region Implementation of IMembershipUser
@@ -118,61 +113,124 @@ namespace Umbraco.Core.Models.Membership
public string Username
{
get { return _username; }
set { SetPropertyValueAndDetectChanges(value, ref _username, Ps.Value.UsernameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_username = value;
return _username;
}, _username, UsernameSelector);
}
}
[DataMember]
public string Email
{
get { return _email; }
set { SetPropertyValueAndDetectChanges(value, ref _email, Ps.Value.EmailSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_email = value;
return _email;
}, _email, EmailSelector);
}
}
[DataMember]
public string RawPasswordValue
{
get { return _rawPasswordValue; }
set { SetPropertyValueAndDetectChanges(value, ref _rawPasswordValue, Ps.Value.PasswordSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_rawPasswordValue = value;
return _rawPasswordValue;
}, _rawPasswordValue, PasswordSelector);
}
}
[DataMember]
public bool IsApproved
{
get { return _isApproved; }
set { SetPropertyValueAndDetectChanges(value, ref _isApproved, Ps.Value.IsApprovedSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_isApproved = value;
return _isApproved;
}, _isApproved, IsApprovedSelector);
}
}
[IgnoreDataMember]
public bool IsLockedOut
{
get { return _isLockedOut; }
set { SetPropertyValueAndDetectChanges(value, ref _isLockedOut, Ps.Value.IsLockedOutSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_isLockedOut = value;
return _isLockedOut;
}, _isLockedOut, IsLockedOutSelector);
}
}
[IgnoreDataMember]
public DateTime LastLoginDate
{
get { return _lastLoginDate; }
set { SetPropertyValueAndDetectChanges(value, ref _lastLoginDate, Ps.Value.LastLoginDateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_lastLoginDate = value;
return _lastLoginDate;
}, _lastLoginDate, LastLoginDateSelector);
}
}
[IgnoreDataMember]
public DateTime LastPasswordChangeDate
{
get { return _lastPasswordChangedDate; }
set { SetPropertyValueAndDetectChanges(value, ref _lastPasswordChangedDate, Ps.Value.LastPasswordChangeDateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_lastPasswordChangedDate = value;
return _lastPasswordChangedDate;
}, _lastPasswordChangedDate, LastPasswordChangeDateSelector);
}
}
[IgnoreDataMember]
public DateTime LastLockoutDate
{
get { return _lastLockoutDate; }
set { SetPropertyValueAndDetectChanges(value, ref _lastLockoutDate, Ps.Value.LastLockoutDateSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_lastLockoutDate = value;
return _lastLockoutDate;
}, _lastLockoutDate, LastLockoutDateSelector);
}
}
[IgnoreDataMember]
public int FailedPasswordAttempts
{
get { return _failedLoginAttempts; }
set { SetPropertyValueAndDetectChanges(value, ref _failedLoginAttempts, Ps.Value.FailedPasswordAttemptsSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_failedLoginAttempts = value;
return _failedLoginAttempts;
}, _failedLoginAttempts, FailedPasswordAttemptsSelector);
}
}
//TODO: Figure out how to support all of this! - we cannot have NotImplementedExceptions because these get used by the IMembershipMemberService<IUser> service so
@@ -193,7 +251,14 @@ namespace Umbraco.Core.Models.Membership
public string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
public IEnumerable<string> AllowedSections
@@ -229,7 +294,14 @@ namespace Umbraco.Core.Models.Membership
public string SecurityStamp
{
get { return _securityStamp; }
set { SetPropertyValueAndDetectChanges(value, ref _securityStamp, Ps.Value.SecurityStampSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_securityStamp = value;
return _securityStamp;
}, _securityStamp, SecurityStampSelector);
}
}
/// <summary>
@@ -258,7 +330,14 @@ namespace Umbraco.Core.Models.Membership
public int SessionTimeout
{
get { return _sessionTimeout; }
set { SetPropertyValueAndDetectChanges(value, ref _sessionTimeout, Ps.Value.SessionTimeoutSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sessionTimeout = value;
return _sessionTimeout;
}, _sessionTimeout, SessionTimeoutSelector);
}
}
/// <summary>
@@ -271,7 +350,14 @@ namespace Umbraco.Core.Models.Membership
public int StartContentId
{
get { return _startContentId; }
set { SetPropertyValueAndDetectChanges(value, ref _startContentId, Ps.Value.StartContentIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_startContentId = value;
return _startContentId;
}, _startContentId, StartContentIdSelector);
}
}
/// <summary>
@@ -284,14 +370,28 @@ namespace Umbraco.Core.Models.Membership
public int StartMediaId
{
get { return _startMediaId; }
set { SetPropertyValueAndDetectChanges(value, ref _startMediaId, Ps.Value.StartMediaIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_startMediaId = value;
return _startMediaId;
}, _startMediaId, StartMediaIdSelector);
}
}
[DataMember]
public string Language
{
get { return _language; }
set { SetPropertyValueAndDetectChanges(value, ref _language, Ps.Value.LanguageSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_language = value;
return _language;
}, _language, LanguageSelector);
}
}
//TODO: This should be a private set
@@ -306,7 +406,14 @@ namespace Umbraco.Core.Models.Membership
internal bool DefaultToLiveEditing
{
get { return _defaultToLiveEditing; }
set { SetPropertyValueAndDetectChanges(value, ref _defaultToLiveEditing, Ps.Value.DefaultToLiveEditingSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_defaultToLiveEditing = value;
return _defaultToLiveEditing;
}, _defaultToLiveEditing, DefaultToLiveEditingSelector);
}
}
[IgnoreDataMember]
@@ -320,7 +427,11 @@ namespace Umbraco.Core.Models.Membership
throw new InvalidOperationException("Cannot assign a User Type that has not been persisted");
}
SetPropertyValueAndDetectChanges(value, ref _userType, Ps.Value.UserTypeSelector);
SetPropertyValueAndDetectChanges(o =>
{
_userType = value;
return _userType;
}, _userType, UserTypeSelector);
}
}
@@ -346,7 +457,7 @@ namespace Umbraco.Core.Models.Membership
/// <param name="e"></param>
void SectionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.AllowedSectionsSelector);
OnPropertyChanged(AllowedSectionsSelector);
if (e.Action == NotifyCollectionChangedAction.Add)
{
+21 -14
View File
@@ -20,14 +20,9 @@ namespace Umbraco.Core.Models.Membership
private string _name;
private IEnumerable<string> _permissions;
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<UserType, string>(x => x.Name);
public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<UserType, string>(x => x.Alias);
public readonly PropertyInfo PermissionsSelector = ExpressionHelper.GetPropertyInfo<UserType, IEnumerable<string>>(x => x.Permissions);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<UserType, string>(x => x.Name);
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<UserType, string>(x => x.Alias);
private static readonly PropertyInfo PermissionsSelector = ExpressionHelper.GetPropertyInfo<UserType, IEnumerable<string>>(x => x.Permissions);
[DataMember]
public string Alias
@@ -35,10 +30,11 @@ namespace Umbraco.Core.Models.Membership
get { return _alias; }
set
{
SetPropertyValueAndDetectChanges(
value.ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase),
ref _alias,
Ps.Value.AliasSelector);
SetPropertyValueAndDetectChanges(o =>
{
_alias = value.ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase);
return _alias;
}, _alias, AliasSelector);
}
}
@@ -46,7 +42,14 @@ namespace Umbraco.Core.Models.Membership
public string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -61,7 +64,11 @@ namespace Umbraco.Core.Models.Membership
get { return _permissions; }
set
{
SetPropertyValueAndDetectChanges(value, ref _permissions, Ps.Value.PermissionsSelector,
SetPropertyValueAndDetectChanges(o =>
{
_permissions = value;
return _permissions;
}, _permissions, PermissionsSelector,
//Custom comparer for enumerable
new DelegateEqualityComparer<IEnumerable<string>>(
(enum1, enum2) => enum1.UnsortedSequenceEqual(enum2),
+18 -10
View File
@@ -19,27 +19,35 @@ namespace Umbraco.Core.Models
_version = version;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MigrationEntry, string>(x => x.MigrationName);
public readonly PropertyInfo VersionSelector = ExpressionHelper.GetPropertyInfo<MigrationEntry, SemVersion>(x => x.Version);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<MigrationEntry, string>(x => x.MigrationName);
private static readonly PropertyInfo VersionSelector = ExpressionHelper.GetPropertyInfo<MigrationEntry, SemVersion>(x => x.Version);
private string _migrationName;
private SemVersion _version;
public string MigrationName
{
get { return _migrationName; }
set { SetPropertyValueAndDetectChanges(value, ref _migrationName, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_migrationName = value;
return _migrationName;
}, _migrationName, NameSelector);
}
}
public SemVersion Version
{
get { return _version; }
set { SetPropertyValueAndDetectChanges(value, ref _version, Ps.Value.VersionSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_version = value;
return _version;
}, _version, VersionSelector);
}
}
}
}
+49 -88
View File
@@ -1,9 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -43,42 +45,8 @@ namespace Umbraco.Core.Models
Value = value;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo ValueSelector = ExpressionHelper.GetPropertyInfo<Property, object>(x => x.Value);
public readonly PropertyInfo VersionSelector = ExpressionHelper.GetPropertyInfo<Property, Guid>(x => x.Version);
}
private static readonly DelegateEqualityComparer<object> ValueComparer = new DelegateEqualityComparer<object>(
(o, o1) =>
{
if (o == null && o1 == null) return true;
//custom comparer for strings.
if (o is string || o1 is string)
{
//if one is null and another is empty then they are the same
if ((o as string).IsNullOrWhiteSpace() && (o1 as string).IsNullOrWhiteSpace())
{
return true;
}
if (o == null || o1 == null) return false;
return o.Equals(o1);
}
if (o == null || o1 == null) return false;
//Custom comparer for enumerable if it is enumerable
var enum1 = o as IEnumerable;
var enum2 = o1 as IEnumerable;
if (enum1 != null && enum2 != null)
{
return enum1.Cast<object>().UnsortedSequenceEqual(enum2.Cast<object>());
}
return o.Equals(o1);
}, o => o.GetHashCode());
private static readonly PropertyInfo ValueSelector = ExpressionHelper.GetPropertyInfo<Property, object>(x => x.Value);
private static readonly PropertyInfo VersionSelector = ExpressionHelper.GetPropertyInfo<Property, Guid>(x => x.Version);
/// <summary>
/// Returns the instance of the tag support, by default tags are not enabled
@@ -130,14 +98,14 @@ namespace Umbraco.Core.Models
public Guid Version
{
get { return _version; }
set { SetPropertyValueAndDetectChanges(value, ref _version, Ps.Value.VersionSelector); }
}
private static void ThrowTypeException(object value, Type expected, string alias)
{
throw new InvalidOperationException(string.Format("Value \"{0}\" of type \"{1}\" could not be converted"
+ " to type \"{2}\" which is expected by property type \"{3}\".",
value, value.GetType(), expected, alias));
set
{
SetPropertyValueAndDetectChanges(o =>
{
_version = value;
return _version;
}, _version, VersionSelector);
}
}
/// <summary>
@@ -153,54 +121,47 @@ namespace Umbraco.Core.Models
get { return _value; }
set
{
var isOfExpectedType = _propertyType.IsPropertyTypeValid(value);
bool typeValidation = _propertyType.IsPropertyTypeValid(value);
if (isOfExpectedType == false) // isOfExpectedType is true if value is null - so if false, value is *not* null
if (typeValidation == false)
throw new Exception(
string.Format(
"Type validation failed. The value type: '{0}' does not match the DataType in PropertyType with alias: '{1}'",
value == null ? "null" : value.GetType().Name, Alias));
SetPropertyValueAndDetectChanges(o =>
{
// "garbage-in", accept what we can & convert
// throw only if conversion is not possible
var s = value.ToString();
switch (_propertyType.DataTypeDatabaseType)
_value = value;
return _value;
}, _value, ValueSelector,
new DelegateEqualityComparer<object>(
(o, o1) =>
{
case DataTypeDatabaseType.Nvarchar:
case DataTypeDatabaseType.Ntext:
value = s;
break;
case DataTypeDatabaseType.Integer:
if (s.IsNullOrWhiteSpace()) value = null; // assume empty means null
else
{
var convInt = value.TryConvertTo<int>();
if (convInt == false) ThrowTypeException(value, typeof(int), _propertyType.Alias);
value = convInt.Result;
}
break;
case DataTypeDatabaseType.Decimal:
if (s.IsNullOrWhiteSpace()) value = null; // assume empty means null
else
{
var convDecimal = value.TryConvertTo<decimal>();
if (convDecimal == false) ThrowTypeException(value, typeof (decimal), _propertyType.Alias);
// need to normalize the value (change the scaling factor and remove trailing zeroes)
// because the underlying database is going to mess with the scaling factor anyways.
value = convDecimal.Result.Normalize();
}
break;
case DataTypeDatabaseType.Date:
if (s.IsNullOrWhiteSpace()) value = null; // assume empty means null
else
{
var convDateTime = value.TryConvertTo<DateTime>();
if (convDateTime == false) ThrowTypeException(value, typeof (DateTime), _propertyType.Alias);
value = convDateTime.Result;
}
break;
}
}
if (o == null && o1 == null) return true;
SetPropertyValueAndDetectChanges(value, ref _value, Ps.Value.ValueSelector, ValueComparer);
//custom comparer for strings.
if (o is string || o1 is string)
{
//if one is null and another is empty then they are the same
if ((o as string).IsNullOrWhiteSpace() && (o1 as string).IsNullOrWhiteSpace())
{
return true;
}
if (o == null || o1 == null) return false;
return o.Equals(o1);
}
if (o == null || o1 == null) return false;
//Custom comparer for enumerable if it is enumerable
var enum1 = o as IEnumerable;
var enum2 = o1 as IEnumerable;
if (enum1 != null && enum2 != null)
{
return enum1.Cast<object>().UnsortedSequenceEqual(enum2.Cast<object>());
}
return o.Equals(o1);
}, o => o.GetHashCode()));
}
}
+20 -12
View File
@@ -29,18 +29,12 @@ namespace Umbraco.Core.Models
PropertyTypes = propertyTypeCollection;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, string>(x => x.Name);
public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, int>(x => x.SortOrder);
public readonly PropertyInfo PropertyTypeCollectionSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, PropertyTypeCollection>(x => x.PropertyTypes);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, string>(x => x.Name);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, int>(x => x.SortOrder);
private readonly static PropertyInfo PropertyTypeCollectionSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, PropertyTypeCollection>(x => x.PropertyTypes);
void PropertyTypesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertyTypeCollectionSelector);
OnPropertyChanged(PropertyTypeCollectionSelector);
}
/// <summary>
@@ -50,7 +44,14 @@ namespace Umbraco.Core.Models
public string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -60,7 +61,14 @@ namespace Umbraco.Core.Models
public int SortOrder
{
get { return _sortOrder; }
set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
+141 -74
View File
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
@@ -46,9 +45,9 @@ namespace Umbraco.Core.Models
public PropertyType(IDataTypeDefinition dataTypeDefinition, string propertyTypeAlias)
: this(dataTypeDefinition)
{
_alias = GetAlias(propertyTypeAlias);
SetAlias(propertyTypeAlias);
}
public PropertyType(string propertyEditorAlias, DataTypeDatabaseType dataTypeDatabaseType)
: this(propertyEditorAlias, dataTypeDatabaseType, false)
{
@@ -56,7 +55,7 @@ namespace Umbraco.Core.Models
public PropertyType(string propertyEditorAlias, DataTypeDatabaseType dataTypeDatabaseType, string propertyTypeAlias)
: this(propertyEditorAlias, dataTypeDatabaseType, false, propertyTypeAlias)
{
{
}
/// <summary>
@@ -84,25 +83,20 @@ namespace Umbraco.Core.Models
_isExplicitDbType = isExplicitDbType;
_propertyEditorAlias = propertyEditorAlias;
_dataTypeDatabaseType = dataTypeDatabaseType;
_alias = GetAlias(propertyTypeAlias);
SetAlias(propertyTypeAlias);
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.Name);
public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.Alias);
public readonly PropertyInfo DescriptionSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.Description);
public readonly PropertyInfo DataTypeDefinitionIdSelector = ExpressionHelper.GetPropertyInfo<PropertyType, int>(x => x.DataTypeDefinitionId);
public readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.PropertyEditorAlias);
public readonly PropertyInfo DataTypeDatabaseTypeSelector = ExpressionHelper.GetPropertyInfo<PropertyType, DataTypeDatabaseType>(x => x.DataTypeDatabaseType);
public readonly PropertyInfo MandatorySelector = ExpressionHelper.GetPropertyInfo<PropertyType, bool>(x => x.Mandatory);
public readonly PropertyInfo HelpTextSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.HelpText);
public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<PropertyType, int>(x => x.SortOrder);
public readonly PropertyInfo ValidationRegExpSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.ValidationRegExp);
public readonly PropertyInfo PropertyGroupIdSelector = ExpressionHelper.GetPropertyInfo<PropertyType, Lazy<int>>(x => x.PropertyGroupId);
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.Name);
private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.Alias);
private static readonly PropertyInfo DescriptionSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.Description);
private static readonly PropertyInfo DataTypeDefinitionIdSelector = ExpressionHelper.GetPropertyInfo<PropertyType, int>(x => x.DataTypeDefinitionId);
private static readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.PropertyEditorAlias);
private static readonly PropertyInfo DataTypeDatabaseTypeSelector = ExpressionHelper.GetPropertyInfo<PropertyType, DataTypeDatabaseType>(x => x.DataTypeDatabaseType);
private static readonly PropertyInfo MandatorySelector = ExpressionHelper.GetPropertyInfo<PropertyType, bool>(x => x.Mandatory);
private static readonly PropertyInfo HelpTextSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.HelpText);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<PropertyType, int>(x => x.SortOrder);
private static readonly PropertyInfo ValidationRegExpSelector = ExpressionHelper.GetPropertyInfo<PropertyType, string>(x => x.ValidationRegExp);
private static readonly PropertyInfo PropertyGroupIdSelector = ExpressionHelper.GetPropertyInfo<PropertyType, Lazy<int>>(x => x.PropertyGroupId);
/// <summary>
/// Gets of Sets the Name of the PropertyType
@@ -111,7 +105,14 @@ namespace Umbraco.Core.Models
public string Name
{
get { return _name; }
set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
/// <summary>
@@ -121,7 +122,14 @@ namespace Umbraco.Core.Models
public string Alias
{
get { return _alias; }
set { SetPropertyValueAndDetectChanges(GetAlias(value), ref _alias, Ps.Value.AliasSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
SetAlias(value);
return _alias;
}, _alias, AliasSelector);
}
}
/// <summary>
@@ -131,7 +139,14 @@ namespace Umbraco.Core.Models
public string Description
{
get { return _description; }
set { SetPropertyValueAndDetectChanges(value, ref _description, Ps.Value.DescriptionSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_description = value;
return _description;
}, _description, DescriptionSelector);
}
}
/// <summary>
@@ -142,14 +157,28 @@ namespace Umbraco.Core.Models
public int DataTypeDefinitionId
{
get { return _dataTypeDefinitionId; }
set { SetPropertyValueAndDetectChanges(value, ref _dataTypeDefinitionId, Ps.Value.DataTypeDefinitionIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_dataTypeDefinitionId = value;
return _dataTypeDefinitionId;
}, _dataTypeDefinitionId, DataTypeDefinitionIdSelector);
}
}
[DataMember]
public string PropertyEditorAlias
{
get { return _propertyEditorAlias; }
set { SetPropertyValueAndDetectChanges(value, ref _propertyEditorAlias, Ps.Value.PropertyEditorAliasSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_propertyEditorAlias = value;
return _propertyEditorAlias;
}, _propertyEditorAlias, PropertyEditorAliasSelector);
}
}
/// <summary>
@@ -183,19 +212,29 @@ namespace Umbraco.Core.Models
//don't allow setting this if an explicit declaration has been made in the ctor
if (_isExplicitDbType) return;
SetPropertyValueAndDetectChanges(value, ref _dataTypeDatabaseType, Ps.Value.DataTypeDatabaseTypeSelector);
SetPropertyValueAndDetectChanges(o =>
{
_dataTypeDatabaseType = value;
return _dataTypeDatabaseType;
}, _dataTypeDatabaseType, DataTypeDatabaseTypeSelector);
}
}
/// <summary>
/// Gets or sets the identifier of the PropertyGroup this PropertyType belongs to.
/// Gets or Sets the PropertyGroup's Id for which this PropertyType belongs
/// </summary>
/// <remarks>For generic properties, the value is <c>null</c>.</remarks>
[DataMember]
internal Lazy<int> PropertyGroupId
{
get { return _propertyGroupId; }
set { SetPropertyValueAndDetectChanges(value, ref _propertyGroupId, Ps.Value.PropertyGroupIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_propertyGroupId = value;
return _propertyGroupId;
}, _propertyGroupId, PropertyGroupIdSelector);
}
}
/// <summary>
@@ -205,7 +244,14 @@ namespace Umbraco.Core.Models
public bool Mandatory
{
get { return _mandatory; }
set { SetPropertyValueAndDetectChanges(value, ref _mandatory, Ps.Value.MandatorySelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_mandatory = value;
return _mandatory;
}, _mandatory, MandatorySelector);
}
}
/// <summary>
@@ -216,7 +262,14 @@ namespace Umbraco.Core.Models
public string HelpText
{
get { return _helpText; }
set { SetPropertyValueAndDetectChanges(value, ref _helpText, Ps.Value.HelpTextSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_helpText = value;
return _helpText;
}, _helpText, HelpTextSelector);
}
}
/// <summary>
@@ -226,7 +279,14 @@ namespace Umbraco.Core.Models
public int SortOrder
{
get { return _sortOrder; }
set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sortOrder = value;
return _sortOrder;
}, _sortOrder, SortOrderSelector);
}
}
/// <summary>
@@ -236,16 +296,23 @@ namespace Umbraco.Core.Models
public string ValidationRegExp
{
get { return _validationRegExp; }
set { SetPropertyValueAndDetectChanges(value, ref _validationRegExp, Ps.Value.ValidationRegExpSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_validationRegExp = value;
return _validationRegExp;
}, _validationRegExp, ValidationRegExpSelector);
}
}
private string GetAlias(string value)
private void SetAlias(string value)
{
//NOTE: WE are doing this because we don't want to do a ToSafeAlias when the alias is the special case of
// being prefixed with Constants.PropertyEditors.InternalGenericPropertiesPrefix
// which is used internally
return value.StartsWith(Constants.PropertyEditors.InternalGenericPropertiesPrefix)
_alias = value.StartsWith(Constants.PropertyEditors.InternalGenericPropertiesPrefix)
? value
: value.ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase);
}
@@ -298,21 +365,18 @@ namespace Umbraco.Core.Models
}
/// <summary>
/// Gets a value indicating whether the value is of the expected type
/// for the property, and can be assigned to the property "as is".
/// Validates the Value from a Property according to its type
/// </summary>
/// <param name="value">The value.</param>
/// <returns>True if the value is of the expected type for the property,
/// and can be assigned to the property "as is". Otherwise, false, to indicate
/// that some conversion is required.</returns>
/// <param name="value"></param>
/// <returns>True if valid, otherwise false</returns>
public bool IsPropertyTypeValid(object value)
{
// null values are assumed to be ok
//Can't validate null values, so just allow it to pass the current validation
if (value == null)
return true;
// check if the type of the value matches the type from the DataType/PropertyEditor
var valueType = value.GetType();
//Check type if the type of the value match the type from the DataType/PropertyEditor
Type type = value.GetType();
//TODO Add PropertyEditor Type validation when its relevant to introduce
/*bool isEditorModel = value is IEditorModel;
@@ -329,29 +393,32 @@ namespace Umbraco.Core.Models
return argument == type;
}*/
if (PropertyEditorAlias.IsNullOrWhiteSpace() == false) // fixme - always true?
if (PropertyEditorAlias.IsNullOrWhiteSpace() == false)
{
// simple validation using the DatabaseType from the DataTypeDefinition
// and the Type of the passed in value
switch (DataTypeDatabaseType)
{
// fixme breaking!
case DataTypeDatabaseType.Integer:
return valueType == typeof(int);
case DataTypeDatabaseType.Decimal:
return valueType == typeof(decimal);
case DataTypeDatabaseType.Date:
return valueType == typeof(DateTime);
case DataTypeDatabaseType.Nvarchar:
return valueType == typeof(string);
case DataTypeDatabaseType.Ntext:
return valueType == typeof(string);
}
//Find DataType by Id
//IDataType dataType = DataTypesResolver.Current.GetById(DataTypeControlId);
//Check if dataType is null (meaning that the ControlId is valid) ?
//Possibly cast to BaseDataType and get the DbType from there (which might not be possible because it lives in umbraco.cms.businesslogic.datatype) ?
//Simple validation using the DatabaseType from the DataTypeDefinition and Type of the passed in value
if (DataTypeDatabaseType == DataTypeDatabaseType.Integer && type == typeof(int))
return true;
if (DataTypeDatabaseType == DataTypeDatabaseType.Decimal && type == typeof(decimal))
return true;
if (DataTypeDatabaseType == DataTypeDatabaseType.Date && type == typeof(DateTime))
return true;
if (DataTypeDatabaseType == DataTypeDatabaseType.Nvarchar && type == typeof(string))
return true;
if (DataTypeDatabaseType == DataTypeDatabaseType.Ntext && type == typeof(string))
return true;
}
// fixme - never reached + makes no sense?
// fallback for simple value types when no Control Id or Database Type is set
if (valueType.IsPrimitive || value is string)
//Fallback for simple value types when no Control Id or Database Type is set
if (type.IsPrimitive || value is string)
return true;
return false;
@@ -376,15 +443,15 @@ namespace Umbraco.Core.Models
var regexPattern = new Regex(ValidationRegExp);
return regexPattern.IsMatch(value.ToString());
}
catch
catch
{
throw new Exception(string .Format("Invalid validation expression on property {0}",this.Alias));
}
}
//TODO: We must ensure that the property value can actually be saved based on the specified database type
//TODO Add PropertyEditor validation when its relevant to introduce
/*if (value is IEditorModel && DataTypeControlId != Guid.Empty)
{
@@ -402,19 +469,19 @@ namespace Umbraco.Core.Models
{
if (base.Equals(other)) return true;
//Check whether the PropertyType's properties are equal.
//Check whether the PropertyType's properties are equal.
return Alias.InvariantEquals(other.Alias);
}
public override int GetHashCode()
{
//Get hash code for the Name field if it is not null.
//Get hash code for the Name field if it is not null.
int baseHash = base.GetHashCode();
//Get hash code for the Alias field.
//Get hash code for the Alias field.
int hashAlias = Alias.ToLowerInvariant().GetHashCode();
//Calculate the hash code for the product.
//Calculate the hash code for the product.
return baseHash ^ hashAlias;
}
@@ -426,7 +493,7 @@ namespace Umbraco.Core.Models
//need to manually assign the Lazy value as it will not be automatically mapped
if (PropertyGroupId != null)
{
clone._propertyGroupId = new Lazy<int>(() => PropertyGroupId.Value);
clone._propertyGroupId = new Lazy<int>(() => PropertyGroupId.Value);
}
//this shouldn't really be needed since we're not tracking
clone.ResetDirtyProperties(false);
+29 -13
View File
@@ -44,7 +44,7 @@ namespace Umbraco.Core.Models
void _ruleCollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.AllowedSectionsSelector);
OnPropertyChanged(AllowedSectionsSelector);
//if (e.Action == NotifyCollectionChangedAction.Add)
//{
@@ -68,15 +68,10 @@ namespace Umbraco.Core.Models
}
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo ProtectedNodeIdSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, int>(x => x.ProtectedNodeId);
public readonly PropertyInfo LoginNodeIdSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, int>(x => x.LoginNodeId);
public readonly PropertyInfo NoAccessNodeIdSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, int>(x => x.NoAccessNodeId);
public readonly PropertyInfo AllowedSectionsSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, IEnumerable<PublicAccessRule>>(x => x.Rules);
}
private static readonly PropertyInfo ProtectedNodeIdSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, int>(x => x.ProtectedNodeId);
private static readonly PropertyInfo LoginNodeIdSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, int>(x => x.LoginNodeId);
private static readonly PropertyInfo NoAccessNodeIdSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, int>(x => x.NoAccessNodeId);
private static readonly PropertyInfo AllowedSectionsSelector = ExpressionHelper.GetPropertyInfo<PublicAccessEntry, IEnumerable<PublicAccessRule>>(x => x.Rules);
internal IEnumerable<Guid> RemovedRules
{
@@ -117,21 +112,42 @@ namespace Umbraco.Core.Models
public int LoginNodeId
{
get { return _loginNodeId; }
set { SetPropertyValueAndDetectChanges(value, ref _loginNodeId, Ps.Value.LoginNodeIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_loginNodeId = value;
return _loginNodeId;
}, _loginNodeId, LoginNodeIdSelector);
}
}
[DataMember]
public int NoAccessNodeId
{
get { return _noAccessNodeId; }
set { SetPropertyValueAndDetectChanges(value, ref _noAccessNodeId, Ps.Value.NoAccessNodeIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_noAccessNodeId = value;
return _noAccessNodeId;
}, _noAccessNodeId, NoAccessNodeIdSelector);
}
}
[DataMember]
public int ProtectedNodeId
{
get { return _protectedNodeId; }
set { SetPropertyValueAndDetectChanges(value, ref _protectedNodeId, Ps.Value.ProtectedNodeIdSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_protectedNodeId = value;
return _protectedNodeId;
}, _protectedNodeId, ProtectedNodeIdSelector);
}
}
public override void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
+18 -9
View File
@@ -23,26 +23,35 @@ namespace Umbraco.Core.Models
{
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
{
public readonly PropertyInfo RuleValueSelector = ExpressionHelper.GetPropertyInfo<PublicAccessRule, string>(x => x.RuleValue);
public readonly PropertyInfo RuleTypeSelector = ExpressionHelper.GetPropertyInfo<PublicAccessRule, string>(x => x.RuleType);
}
private static readonly PropertyInfo RuleValueSelector = ExpressionHelper.GetPropertyInfo<PublicAccessRule, string>(x => x.RuleValue);
private static readonly PropertyInfo RuleTypeSelector = ExpressionHelper.GetPropertyInfo<PublicAccessRule, string>(x => x.RuleType);
public Guid AccessEntryId { get; internal set; }
public string RuleValue
{
get { return _ruleValue; }
set { SetPropertyValueAndDetectChanges(value, ref _ruleValue, Ps.Value.RuleValueSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_ruleValue = value;
return _ruleValue;
}, _ruleValue, RuleValueSelector);
}
}
public string RuleType
{
get { return _ruleType; }
set { SetPropertyValueAndDetectChanges(value, ref _ruleType, Ps.Value.RuleTypeSelector); }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_ruleType = value;
return _ruleType;
}, _ruleType, RuleTypeSelector);
}
}
@@ -114,25 +114,10 @@ namespace Umbraco.Core.Models.PublishedContent
internal static void ClearContentType(int id)
{
Logging.LogHelper.Debug<PublishedContentType>("Clear content type w/id {0}.", () => id);
// we don't support "get all" at the moment - so, cheating
var all = ApplicationContext.Current.ApplicationCache.StaticCache.GetCacheItemsByKeySearch<PublishedContentType>("PublishedContentType_").ToArray();
// the one we want to clear
var clr = all.FirstOrDefault(x => x.Id == id);
if (clr == null) return;
// those that have that one in their composition aliases
// note: CompositionAliases contains all recursive aliases
var oth = all.Where(x => x.CompositionAliases.InvariantContains(clr.Alias)).Select(x => x.Id);
// merge ids
var ids = oth.Concat(new[] { clr.Id }).ToArray();
// clear them all at once
// we don't support "clear many at once" at the moment - so, cheating
// requires a predicate because the key does not contain the ID
// faster than key strings comparisons anyway
ApplicationContext.Current.ApplicationCache.StaticCache.ClearCacheObjectTypes<PublishedContentType>(
(key, value) => ids.Contains(value.Id));
(key, value) => value.Id == id);
}
internal static void ClearDataType(int id)
@@ -16,7 +16,7 @@ namespace Umbraco.Core.Models.Rdbms
[Column("contentNodeId")]
[ForeignKey(typeof(NodeDto))]
[Index(IndexTypes.UniqueNonClustered, Name = "IX_cmsPropertyData_1", ForColumns = "contentNodeId,versionId,propertytypeid")]
[Index(IndexTypes.NonClustered, Name = "IX_cmsPropertyData_1")]
public int NodeId { get; set; }
[Column("versionId")]
@@ -33,23 +33,9 @@ namespace Umbraco.Core.Models.Rdbms
[NullSetting(NullSetting = NullSettings.Null)]
public int? Integer { get; set; }
private decimal? _decimalValue;
[Column("dataDecimal")]
[NullSetting(NullSetting = NullSettings.Null)]
public decimal? Decimal
{
get
{
return _decimalValue;
}
set
{
// need to normalize the value (change the scaling factor and remove trailing zeroes)
// because the underlying database probably has messed with the scaling factor.
_decimalValue = value.HasValue ? (decimal?) value.Value.Normalize() : null;
}
}
public decimal? Decimal { get; set; }
[Column("dataDate")]
[NullSetting(NullSetting = NullSettings.Null)]
@@ -1,5 +1,4 @@
using System;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence;
namespace Umbraco.Core.Models.Rdbms
{
@@ -19,8 +18,5 @@ namespace Umbraco.Core.Models.Rdbms
[Column("contenttypeNodeId")]
public int ContentTypeNodeId { get; set; }
[Column("PropertyGroupUniqueID")]
public Guid UniqueId { get; set; }
}
}
@@ -51,8 +51,5 @@ namespace Umbraco.Core.Models.Rdbms
[Column("dbType")]
public string DbType { get; set; }
[Column("UniqueID")]
public Guid UniqueId { get; set; }
}
}
@@ -1,50 +0,0 @@
using System;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
[TableName("umbracoRedirectUrl")]
[PrimaryKey("id", autoIncrement = false)]
[ExplicitColumns]
class RedirectUrlDto
{
public RedirectUrlDto()
{
CreateDateUtc = DateTime.UtcNow;
}
// notes
//
// we want a unique, non-clustered index on (url ASC, contentId ASC, createDate DESC) but the
// problem is that the index key must be 900 bytes max. should we run without an index? done
// some perfs comparisons, and running with an index on a hash is only slightly slower on
// inserts, and much faster on reads, so... we have an index on a hash.
[Column("id")]
[PrimaryKeyColumn(Name = "PK_umbracoRedirectUrl", AutoIncrement = false)]
public Guid Id { get; set; }
[ResultColumn]
public int ContentId { get; set; }
[Column("contentKey")]
[NullSetting(NullSetting = NullSettings.NotNull)]
[ForeignKey(typeof(NodeDto), Column = "uniqueID")]
public Guid ContentKey { get; set; }
[Column("createDateUtc")]
[NullSetting(NullSetting = NullSettings.NotNull)]
public DateTime CreateDateUtc { get; set; }
[Column("url")]
[NullSetting(NullSetting = NullSettings.NotNull)]
public string Url { get; set; }
[Column("urlHash")]
[NullSetting(NullSetting = NullSettings.NotNull)]
[Index(IndexTypes.UniqueNonClustered, Name = "IX_umbracoRedirectUrl", ForColumns = "urlHash, contentKey, createDateUtc")]
[Length(40)]
public string UrlHash { get; set; }
}
}
@@ -1,10 +1,11 @@
using System;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
[Obsolete("This is no longer used and will be removed from Umbraco in future versions")]
[TableName("cmsStylesheet")]
[PrimaryKey("nodeId", autoIncrement = false)]
[ExplicitColumns]
internal class StylesheetDto
{
[Column("nodeId")]
@@ -1,10 +1,11 @@
using System;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
[Obsolete("This is no longer used and will be removed from Umbraco in future versions")]
[TableName("cmsStylesheetProperty")]
[PrimaryKey("nodeId", autoIncrement = false)]
[ExplicitColumns]
internal class StylesheetPropertyDto
{
[Column("nodeId")]

Some files were not shown because too many files have changed in this diff Show More