Umbraco Version 8 Technical Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, | |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
// See the License for the specific language governing permissions and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I have a concern that despite having lots of tests and "good enough" test coverage, we | |
// are more or test "testing everything" in the hope of catching issues, but not using a | |
// very deterministic approach. I would rather split our tests per layers, and validate | |
// that each layer is OK. | |
// | |
// This file contains a sample test for the HMap.SetAsync method (aka map.set) that does | |
// rely on the entire client-side pipeline of using the codec to create a message, | |
// serializing the message and sending its frames over a TCP socket -- but does *not* | |
// rely on an Hazelcast cluster: instead, the test relies on a lightweight server that | |
// can receive, and respond to, messages. We use it to capture and validate the message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// executed with: | |
// var config = DefaultConfig.Instance | |
.WithArtifactsPath(artPath) | |
.AddDiagnoser(MemoryDiagnoser.Default) | |
.AddJob(Job.InProcess); | |
// BenchmarkRunner.Run(typeof(NullCoalesce), config); | |
public class NullCoalesce | |
{ | |
private bool _toggle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Microsoft.Extensions.DependencyInjection; | |
using System.Linq; | |
using System.Reflection; | |
using System.Reflection.Emit; | |
namespace MSDI | |
{ | |
public static class NamedServiceExtensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Configs; | |
using BenchmarkDotNet.Diagnosers; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Validators; | |
// here are the results I get: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace TestRunner | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IPublishedContent implements IsFirst, IsOdd, Index and various stuff | |
// so technically it's possible to do | |
@foreach(var content in contents) | |
{ | |
<div class="@(content.IsFirst() ? "first" : "") @(content.IsOdd() ? "odd" : "even")" id="item-@(content.Index())"> | |
@content.Name | |
</div> | |
} | |
// however, because of some issues in IPublishedContent, IsFirst, IsOdd, Index... all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// demo of a basic strongly typed published content for an article | |
// you just need to drop the following class anywhere in your code | |
// and every strongly typed methods returning IPublishedContent will | |
// actually return an Article instance (which is an IPublishedContent) | |
// we want the class named Article though the content type alias is 'newsArticle' | |
[PublishedContentModel("newsArticle")] | |
public partial class Article : PublishedContentModel | |
{ | |
public Article(IPublishedContent content) |