This file contains hidden or 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
| public class Startup | |
| { | |
| public void ConfigureServices( IServiceCollection services ) | |
| { | |
| services.AddMvc(); | |
| services.AddApiVersioning(); | |
| }} | |
| } |
This file contains hidden or 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
| module.exports = function() { | |
| var azure = require('azure'); | |
| var topic = "foo-bar"; | |
| var connectionString = "Endpoint=sb://"; | |
| console.log("Configuring Service Bus."); | |
| var serviceBusService = azure.createServiceBusService(connectionString); | |
| var movies = []; |
This file contains hidden or 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
| module.exports = function() { | |
| var azure = require('azure'); | |
| var topic = "foo-bar"; | |
| var connectionString = "Endpoint=sb://..."; | |
| console.log("Configuring Service Bus."); | |
| var serviceBusService = azure.createServiceBusService(connectionString); | |
| var movies = []; |
This file contains hidden or 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
| var difference = new Set(existingIntegers); | |
| for(var index = 0; index < downloadedIntegers.length; index++) { | |
| if (!existingIntegers.has(downloadedIntegers[index])) { | |
| difference.push(downloadedIntegers[index]); | |
| } | |
| } |
This file contains hidden or 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
| var difference = array1.filter(function(item, index) { | |
| return !array2.includes(item); | |
| }); |
This file contains hidden or 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
| public class AccountValidator : Validator<Account> | |
| { | |
| public AccountValidator() | |
| { | |
| base.AddSpecifications( | |
| new EmailAddressFormatIsValidSpec(), | |
| new PasswordIsRequiredSpec(), | |
| new StringIsNotEmpty<User>(model => model.Username), | |
| new StringIsNotEmpty<Account>(model => model.AccountNumber), | |
| new UsernameIsRequiredSpec()); |
This file contains hidden or 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
| /// <summary> | |
| /// Specification to ensure a string property on a model has a value | |
| /// </summary> | |
| public class MinimumLengthSpecification<TEntity> : ISpecification<TEntity> | |
| { | |
| // Store the property selector | |
| private readonly Func<TEntity, string> propertySelector; | |
| private readonly int minimumLength; |
This file contains hidden or 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
| public class Startup | |
| { | |
| private IContainer ApplicationContainer; | |
| public Startup(IHostingEnvironment env) | |
| { | |
| var builder = new ConfigurationBuilder() | |
| .SetBasePath(env.ContentRootPath) | |
| .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) | |
| .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) |
This file contains hidden or 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
| // Create repositories as part of a unit of work. | |
| using (IUnitOfWork unitOfWork = this.UnitOfWorkFactory.CreateUnitOfWork()) | |
| { | |
| IMovieHeaderRepository repo2 = unitOfWork.GetRepository<IMovieHeaderRepository>(); | |
| await repo2.Save(this.Movie); | |
| IGenreRepository repo3 = unitOfWork.GetRepository<IGenreRepository>(); | |
| foreach(Movie movie in movies) | |
| await repo3.Save(movie.Genre); | |
| } |
This file contains hidden or 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
| syntax = "proto3"; | |
| package AComms.Services; | |
| // Client service definitions | |
| service Messenger { | |
| // Send a greeting message | |
| rpc SayHello(HelloRequest) returns (HelloReply) {} | |
| } |