Note: Tested on Autofac 4.9.2.
Autofac Keyed Services provide convenience way to register multiple types of same interface with key identifier, see the documentation here.
This is where we register our type in Autofac container.
This is global object to store our container for resolving type later in application lifecycle.
This is sample service interface – don't copy, make your own.
This is sample service interface implementation – don't copy, make your own.
There are 2 options to resolve `IService` to type we desired (ie: Corporate or School).
Sample controller that choose which service to initiate.
2. Resolving with an Index (recommended).
I just finished my project, written in Angular and although it runs on mobile browsers, it needs to be deployed as a native application. The choice is obvious, Ionic.
I'm integrating Ionic for Android development, but it's optional. You don't have to prepare your Ionic project for Android development, if you don't want to. The same concept can also be used to prepare your project for iOS development.
Java SDK 8 update 202.
Here's my approach integrating Ionic in my Angular project.
The step includes creating a new project using Ionic CLI, I'm going to refer it as Ionic project while my original Angular project as, well, Angular project.
In your Angular project, update all npm packages, to the latest major if you can. This is to avoid version conflict with Ionic project's npm packages.
Start a new Ionic blank project.
Update all npm packages in the newly created Ionic project.
Copy ionic.config.json from Ionic project to Angular project.
Copy angular.json from Ionic project to Angular project.
If you have specifically changed anything in your angular.json, make that necessary changes in the Angular project after the copy.
Ionic uses SCSS for style sheet by default, so if you are not using SCSS, make sure to copy settings under projects/app/architect/**/options/styles from Angular project's angular.json prior to copy.
Copy package.json from Ionic project to Angular project.
If you have specifically changed anything in your package.json (npm scripts, etc), make that necessary changes in the Angular project after the copy.
Combine the npm packages from both projects setting under dependencies and devDependencies.
Combine .gitignore files from both projects, if you are using Git source control.
In Angular project, delete package-lock.json file and node_modules folder. These should be located in root of the project.
In Angular project, run npm install command.
Test and make sure everything runs.
If you want to prepare your project for Cordova, runs the following command. Note that environment setup is required. Please refer to reference section for more details.
Azure Resource Manager, or ARM, is a way to manage resources in Azure. With ARM, we will be able to define our platform, or infrastructure, as code.
One of the benefits of using code to manage platform / infrastructure is we can check in to source control to see different changes over time. It also allow us to reuse part of the code for other deployment.
Manage resources. Deploy, add, remove resources at ease.
Resource grouping. Group resource into logical set that makes sense to you, i.e.: environment, location, etc.
Resource dependencies. Handle dependencies between different resources.
Repeatable deployments. ARM template can be used to perform same. repeatable deployments.
Template. Using template and code to define platform / infrastructure. Template is also reusable.
Resource providers. These are the functionalities of the resources, such as compute, storage, etc.
Resource types. The actual resource of Azure services that will be deployed.
ARM REST APIs. Allow invocation of ARM command thru its APIs.
You can also abstract out parameters for a ARM template to its own template parameter file. ARM template parameter must also have schema and version. The version doesn't have to be the same with the template file.
In ARM template deployment, Azure automatically detect dependencies between resource types and deploy the dependent resource first. For example, if a template has specified to deploy App Service Plan and App Service Web Site, ARM REST API will deploy App Service Plan first, which Web Site depends on.
You can also specify dependency in ARM template as well as deploy resources simultaneously for services that don't have dependency, i.e. deploying 4 App Service Websites.
Azure Resource Manager will only deploy resources in the template that are not yet exist. When you the specified resource already exists, it will be skipped.
Within ARM template, you can also specify to deploy the application itself, this is useful, for example, when the App Service Web Site deployment will include populating the website with web application from source control.
With today's big data requirements where data could be structured, unstructured, batch, stream and come in many other forms and size, traditional data warehouse is not going to cut it.
Different technology is required at different stage. This also depends heavily on size and form of data and the 4 Vs: Volume, Variety, Velocity, Veracity.
Integration with existing / others system.
Azure offers many services for data warehouse solutions. Traditionally, data warehouse has been ETL process + relational database storage like SQL Data Warehouse. Today, that may not always be the case.
Azure offers various cluster types that comes with HDInsight, fully managed by Microsoft, but still require management from users. Also supports Data Lake Storage. More about HDInsight. HDInsight sits on "Processing" data stage.
Its support for machine learning, AI, analytics and stream / graph processing makes it a go-to solution for data processing. It's also fully integrated with Power BI and other source / destination tools. Notebooks in Databricks allows collaboration between data engineers, data scientist and business users. Compare to HDInsight.
The "Ingest" part of data stage. Its function is to bring data in and move them around different system. Azure Data Factory supports different pipelines across Azure services to connect the data and even on-premise data. Azure Data Factory can be used to control the flow of data.
Typically the end destination of data and to be consumed by business users. SQL DW is platform as a service, require less management from users and great for team who already familiar with TSQL and SSMS (SQL Management Studio). You can also scale it dynamically, pause / resume the compute. SQL DW uses internal storage to store data and include the compute component. SQL Data Warehouse sits on "Consuming" stage.
SQL database, or other relational database system, Cosmos are part of the storage solutions offered in Azure Services. This is typically more expensive than Azure Storage, but also offer other features. Database services are part of "Storage" stage.
Build on top of Azure Storage, ADLS offers unlimited storage and file system based on HDFS, allowing optimization for analytics purpose, like Hadoop or HDInsight. ADLS is part of "Storage" stage.
ADLA is a high-level abstraction of HDInsight. Users will not need to worry about scaling and management of the clusters at all, it's an instant scale per job. However, this also comes with some limitations. ADLA support USQL, a SQL-like language that allows custom user defined function in C#. The tooling is also what developers are already familiar with, Visual Studio.
There's no right or wrong answer. The right solution depends on many others things, technical and non-technical as well as the considerations mentioned above.
This is step by step setup of using SQL Server TVP (Table Valued Parameter) in .Net application with EF (Entity Framework). In this example, I use SQL Server 2016 (SP2-CU3), .Net 4.5.1 and EF 6.20.
1. Create a table to store data.
2. Create `User Defined Table Type` in SQL Server. For simplicity, in this example the type's columns are same as table I created on step 1. In real-world, the type's columns could be significantly different than table where we store the data, it might even used for join with other tables.
3. Create stored procedure to take parameter (of a `User Defined Table` type we created earlier) and perform necessary task to persist our data.
4. Create extension method to convert `IEnumerable<T>` object to a `DataTable` object. In order to use SQL TVP, we have to pass our parameter as a `DataTable`. This method will help convert our data to `DataTable` type.
5. For the purpose of this example, let's say we want to save a collection of objects. This is our object definition.
6. Using EF, called stored procedure we created and pass in `SqlParameter`, which is a collection of objects that we converted to `DataTable`. Don't forget to specify parameter type as `User Defined Table Type`.
Applies to .Net application in Visual Studio 2010 and up.
For unit test, I'd created separate project (call it QCTest project). Because internal members can only be accessed in same assembly, I won't be able to invoke `QC.PersonService.FindPerson(string userName)` method from QCTest project.
After rebuilding my solution, I am able to access `QC.PersonService.FindPerson(string userName)` in my QCTest project.
DynamicProxyGenAssembly2 is a temporary assembly built by mocking systems that use CastleProxy like Moq or NSubsitute. It is generated when the mock is needed and disposed of after the tests are finished.
Reason why I unit test my DTO (Data Transfer Object) classes are because I pass these classes to client app and client app might use them and expect certain properties in response. Sometimes I change DTO properties that I used in client app and forget to refactor client app.
By unit testing my DTO classes, it acts as reminder for me to refactor client app whenever DTO properties (or its name) changes.
For example, I have Person DTO.
To unit test, I would create PersonMirror DTO.
Then use following helper class to unit test my DTO.