Giter Site home page Giter Site logo

umbraconinedemosite's People

Contributors

a-karandashov avatar adolfi avatar bjarnef avatar idseefeld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

umbraconinedemosite's Issues

Initial Upgrade error

Cloned the code to have a play and on the initial run, the umbraco upgrade screen came up trying to upgrade the sdf database so converted it to a local sql database and then had another database error

The database failed to upgrade. ERROR: The database configuration failed with the following message: 'FK_umbracoRedirectUrl_umbracoNode_uniqueID' is not a constraint

So had to "hack" in the constraint with this script

ALTER TABLE umbracoRedirectUrl ADD CONSTRAINT FK_umbracoRedirectUrl_umbracoNode_uniqueID CHECK (Id != null);

So the upgrade can proceed and remove it :), just putting this here more for an fyl i guess as i have got past it,

Actual log in the log file is below:

{"@t":"2021-08-03T11:29:07.7897593Z","@mt":"Database configuration failed","@l":"Error","@x":"System.Data.SqlServerCe.SqlCeException (0x80004005): Cannot alter column of type NTEXT or IMAGE [ Column Name = data ]\r\n at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)\r\n at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor)\r\n at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)\r\n at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\\projects\\dotnet\\src\\MiniProfiler.Shared\\Data\\ProfiledDbCommand.cs:line 281\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<ExecuteNonQuery>b__31_0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<>c__DisplayClass33_01.b__0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.Execute[T](Func1 f)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.ExecuteNonQuery()\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\n at NPoco.Database.Execute(Sql Sql)\r\n at NPoco.Database.Execute(String sql, Object[] args)\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationExpressionBase.ExecuteStatement(StringBuilder stmtBuilder)\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationExpressionBase.Execute()\r\n at Umbraco.Cms.Infrastructure.Migrations.Expressions.Execute.ExecuteBuilder.Do()\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationBase.AlterColumn[T](String tableName, String columnName)\r\n at Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_15_0.AddCmsContentNuByteColumn.Migrate()\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationBase.Run()\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor.Execute(MigrationPlan plan, String fromState)\r\n at Umbraco.Cms.Infrastructure.Migrations.Upgrade.Upgrader.Execute(IMigrationPlanExecutor migrationPlanExecutor, IScopeProvider scopeProvider, IKeyValueService keyValueService)\r\n at Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder.UpgradeSchemaAndData(UmbracoPlan plan)","SourceContext":"Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder","ActionId":"6a7b1838-f82a-4938-8640-ccbb6fdcabf7","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"80000008-0004-f300-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":3408,"ProcessName":"iisexpress","ThreadId":18,"AppDomainId":1,"AppDomainAppId":"52972cfa0511fad25ec89b50a95b9e35bc00e389","MachineName":"DESKTOP-Q638HB1","Log4NetLevel":"ERROR","HttpRequestId":"fe93197b-71a7-4d99-adb0-1c2852ef6d83","HttpRequestNumber":6,"HttpSessionId":"e603b8a9-873c-08da-218a-f33e411f46aa"}

{"@t":"2021-08-03T12:27:48.0412468Z","@mt":"Exception ({InstanceId}).","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): 'FK_umbracoRedirectUrl_umbracoNode_uniqueID' is not a constraint.\r\nCould not drop constraint. See previous errors.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)\r\n at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\\projects\\dotnet\\src\\MiniProfiler.Shared\\Data\\ProfiledDbCommand.cs:line 281\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<ExecuteNonQuery>b__31_0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<>c__DisplayClass33_01.b__0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.Execute[T](Func1 f)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.ExecuteNonQuery()\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\n at NPoco.Database.Execute(Sql Sql)\r\n at NPoco.Database.Execute(String sql, Object[] args)\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationExpressionBase.ExecuteStatement(StringBuilder stmtBuilder)\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationExpressionBase.Execute()\r\n at Umbraco.Cms.Infrastructure.Migrations.Expressions.Common.ExecutableBuilder.Do()\r\n at Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_15_0.UpgradedIncludeIndexes.Migrate()\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationBase.Run()\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor.Execute(MigrationPlan plan, String fromState)\r\n at Umbraco.Cms.Infrastructure.Migrations.Upgrade.Upgrader.Execute(IMigrationPlanExecutor migrationPlanExecutor, IScopeProvider scopeProvider, IKeyValueService keyValueService)\r\n at Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder.UpgradeSchemaAndData(UmbracoPlan plan)\r\nClientConnectionId:31e1e3d2-447f-45cf-bc25-83ce81710926\r\nError Number:3728,State:1,Class:16","InstanceId":"733a7681","SourceContext":"Umbraco.Cms.Infrastructure.Persistence.UmbracoDatabase","ActionId":"6d8ce72f-c9fb-4bfb-a290-b6c4916c28e6","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"80000008-000a-fc00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":21608,"ProcessName":"iisexpress","ThreadId":105,"AppDomainId":1,"AppDomainAppId":"52972cfa0511fad25ec89b50a95b9e35bc00e389","MachineName":"DESKTOP-Q638HB1","Log4NetLevel":"ERROR","HttpRequestId":"9513c34a-4d2f-4a6a-a1dc-9d275a6cd19b","HttpRequestNumber":6,"HttpSessionId":"81213d84-4d7c-1b77-fa2a-54eae8677338"}
`

Replace ContentAtXPath

I noticed ContentAtXPath() is used here:
https://github.com/Adolfi/UmbracoNineDemoSite/blob/master/UmbracoNineDemoSite.Core/Features/Shared/Settings/SiteSettings.cs#L17-L18

In both Umbraco v8 and v9 there is no longer an XML config/cache, so it is NuCache representation as XML and using XPathNavigator. Most of the time we don't need it though.

So with NuCache it should be faster using the LINQ queries or in other cases Examine.

Something like this:

private IPublishedContent home => this.umbracoHelper.ContentAtRoot().Where(x => x.ContentType.Alias == ContentTypeAlias.Home)?.FirstOrDefault();
private IPublishedContent settings => this.umbracoHelper.ContentAtRoot().Where(x => x.ContentType.Alias == ContentTypeAlias.SiteSettings)?.FirstOrDefault();

or

private IPublishedContent home => this.umbracoHelper.ContentAtRoot().FirstOrDefault(x => x.ContentType.Alias == ContentTypeAlias.Home);
private IPublishedContent settings => this.umbracoHelper.ContentAtRoot().FirstOrDefault(x => x.ContentType.Alias == ContentTypeAlias.SiteSettings);

Furthermore I think it could use .Value() / Value<T>() extension method if the code should be a bit more simpler.

public string CallToActionHeader => this.settings.Value<string>(PropertyAlias.CallToActionHeader);

Add custom field to Member index

Sorry if this is not the right place to ask, but I am seriously struggling to find out how to do this and wondered if there is any code here that would help:

I have added some custom fields to the Member type and want to add them to the Member index. My last project was using Umbraco 7 and I have skipped V8 and gone straight to V9 for this current project, so configuring Examine indexes is completely different!

So, say I have added a field to the Member type which has an alias of "disableBalanceAlert" ... how do I include this as a searchable field in the Member index?

Again, if this is not an appropriate question here, then just comment as such and I'll continue my search elsewhere.

Models Builder for “simpler” sites? 🤔

Hi Denis (and other contributors)!

Great work on this one! Really awesome and thanks for sharing it! I would definitely contribute in the future! I really think that this project has the potential of being a great source of inspiration and best practice for Umbraco websites going forward. Like a documentation that actually shows how to solve the “real” problems implementors are facing.

I’m wondering about ditching Models Builder. Is there a really good reason not to use it in a best practice example?

I do get that you don’t want to expose the whole cms-model (IPublishedContent) in the view but wouldn’t the mapping in the controllers be cleaner/safer if done from a models builder model? The models created by Models Builder is basically what you are doing manually in the controllers but without all the constants for property names, or actually more “automatic constants” with the strongly typed names. They also keep information about any Compositions so one can go ie:

if(model is IPageWithHero hero) {}

It’s also safer for any changes in the document type - MB would give a compiler warning. The current solution will throw at runtime in best case or silently fail/behave strange if I forget to change the constant for the property alias.

Did you actively decide not to go with Models Builder? It would be nice to hear more about why and maybe document that decision.

And also, I think it sounds bad to indicate that models builder is only suitable for “simpler projects” (in the readme) - that might put a lot of people in the wrong direction, I would say that it might be a matter of taste but from a technical standpoint running without Model Builder is a less safe and sustainable way of building a complex and maintainable solution with Umbraco - more manual work and more prone to errors.

Would be nice to hear your thoughts?

Cheers man!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.