This post is just a reference point (collation of links to other great posts), to help folks who are new to the arena, looking for ways to develop a Single Page Application (SPA) using ASP.NET Core Web Application with Angular (4.0) as the front end development framework.
The below are the list of options that one can leverage for creating a new ASP.NET Core based SPA application :
If you are looking for a ready-to-develop SPA with all bells and whistles put together, then try the below template from Mark PiesZak. It has all the required packages pre-configured and supports SEO optimization and by far the best template available for development with ASP.NET CORE + ANGULALR 4.0. (If any one has a better template/link, please do share just so I can update the post accordingly)
Just download the code from git and follow the instructions on the site to get started!
162 total views, no views today
Step 1 (Install Node):
Download and Install NodeJS from this link
Step 2 (Install Mongo DB):
Download and Install Mongo DB from this link (make sure that you follow the instructions on the page to setup the Windows service and test it, before proceeding further).
Step 3 (Setup development environment):
- Fire up “Visual Studio Code” and use the “Open Folder” option to point to “any” folder where you plan to create/store the project specific files (to be created as part of the “hello world” application).
- Use the “File-> New File” option (or the “New File” in the Explorer window) to create a new file and name it as “main.js“.
- Launch the “Integrated Terminal” window from “View->Integrated Terminal”.
- Type “npm init” (as provided in the below image and keep pressing “enter” for all questions prompted to assign the default values, which can be overridden by providing a custom value, if preferred).
- When completed it will create the “package.json” file along with all the default settings.
- Open up the “package.json” and add the dependencies for mongodb and mongoose (as highlighted below) and save the file:
- In the “Integrated Terminal” type “npm install” and hit enter
- After the dependencies are installed by npm, you should see the “node_modules” folder on the explorer window (which contains all the dependent npm modules required for mongodb and mongoose to run in nodejs ecosystem):
802 total views, 1 views today
The above error occurs typically when you try to install an add-in from the SharePoint Store using the O365 Global administrator account.
- GoTo Office 365 Admin Portal.
- Under Users, Select “Active Users” and Add a user
- Make sure that you choose “SharePoint Administrator” as the role for the new user
- Now try to login to the site using the new user and add the app from the SharePoint Store.
The above had worked for me when I tried to add the Napa developer tool to the Dev site.
614 total views, 1 views today
Public Sub LoadCodeFromFileAndExecute()
Dim objCodeCompiler As System.CodeDom.Compiler.CodeDomProvider = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("VisualBasic")
Dim objCompilerParameters As New System.CodeDom.Compiler.CompilerParameters
''The below one is a custom dll that I require for processing the logic (and have provided as an example, just so you can refer such custom ones as required)
''Again, the Nlog is used for logging and the configuration for Nlog is loaded from the web.config, when the application initializes itself.
objCompilerParameters.GenerateInMemory = True
' Get the source code and compile it from the file system (assuming that your code itself is residing in the bin folder from where the application is being executed)
Dim strCode As String = String.Empty
Using sw As StreamReader = New StreamReader("D:\\DynamicCode\\bin\\GetLogDetailsFromDictionary.vb")
strCode = sw.ReadToEnd()
''Try to compile the code
Dim objCompileResults As System.CodeDom.Compiler.CompilerResults = objCodeCompiler.CompileAssemblyFromSource(objCompilerParameters, strCode)
' Check for compiler errors. In my case I am just exiting the Sub
If objCompileResults.Errors.HasErrors Then
' Get a reference to the NEW assembly emitted by CodeDom as part of the compilation performed in the earlier statement
Dim objAssembly As System.Reflection.Assembly = objCompileResults.CompiledAssembly
' Create an instance of the DynamicCode class referenced in the source code.
Dim objTheClass As Object = objAssembly.CreateInstance("HelloWorld")
''Verify if the CreateInstance was able to generate a new instance successfully
If objTheClass Is Nothing Then
''Invoke the Method
Dim objResult As Object = objTheClass.GetType.InvokeMember("SayHello", _
BindingFlags.InvokeMethod, Nothing, objTheClass, Nothing)
Catch ex As Exception
763 total views, 1 views today
The below are some tips towards optimizing the performance of applications that use Entity Framework.
- To disable AutoDetectChanges, when not needed (https://msdn.microsoft.com/en-us/data/jj556205.aspx / https://blog.oneunicorn.com/2012/03/12/secrets-of-detectchanges-part-3-switching-off-automatic-detectchanges/)
- Even though the DBContext object is a lightweight one, its the number of entities that affects the performance. For instance, after you are done creating a new DbContext, if you perform repeated .Add(..) and .SaveChanges(), at one point you will see a downgrade in performance and if investigated, it will point to the number of Entities that incrementally got included resulting in degrading the performance of the DBContext object. A solution is to dispose the DBContext and create new objects for a set of operations (for instance every 1000 objects), however from a “Data Integrity / Atomicity” (ACID) perspective, every DbContext will use its own connection and multiple connections will require MSDTC, which at times can be a trouble to live with in the long run. So, in such cases, we could resort to the option of using a single Connection and TransactionScope as outlined in the MSDN link. (https://msdn.microsoft.com/en-us/data/dn456843.aspx#existing).
- As a rule of thumb, while retrieving data from the database, retrieve only those fields are required. This is not just for including a where condition aimed at filtering the records, but also the fields that are required.
- Use Take & Skip in EF to query data based on “pages” (http://stackoverflow.com/questions/3870091/entity-framework-linq-to-sql-skip-take)
- Avoid calling SaveChanges() for every transaction, but instead try to call the SaveChanges() for every 500 iterations and dispose the old dbcontext and generate a new one. This approach eliminates the need to perform the change detection for each record (when saved individually) and as well removes network latency involved in persisting the changes to the data base. However, regeneration of the context object would essentially mean a SQLConnection is assigned to the db context, which would result in MSDTC (as there are multiple connections involved – one per context).
- Use SQLBulkCopy if it involves inserting multiple records (thousands of rows) http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx
- If you do not want to disable the AutoDetectChanges, another option is to detach the entities that are already committed through the SaveChanges() operation. This would reduce the number of entities being accumulated in the dbContext as we progress through the loop/iterations and help eliminate the lag that gets induced when the entities count in the db context crosses a threshold (which could vary depending on how relational the entities are).
781 total views, 1 views today
If you are looking for a good source of code examples towards getting started with Azure, then I would recommend to use something that’s available right off the Visual Studio IDE.
When you try to create a new project, under cloud select “Quick Starts” to view the grand list of Azure offerings and pick your type of project to automatically create a sample application along with the necessary plumbing logic to consume the particular service:
411 total views, 1 views today
When I tried to setup Orchard CMS using MY SQL 5.7 as the back end, was haunted by the below errors relating to Indexes:
1)create index `IDX_AutoroutePartRecord_DisplayAlias` on `Orchard_Autoroute_AutoroutePartRecord` (DisplayAlias)
2)create index `IDX_RecipeStepResultRecord_ExecutionId_StepName` on `Orchard_Recipes_RecipeStepResultRecord` (ExecutionId, StepName)
3)create index `IDX_MediaPartRecord_FolderPath` on `Orchard_MediaLibrary_MediaPartRecord` (FolderPath) "
To solve the errors, had to change the script as below : (since per MY SQL, BLOBS and TEXT columns can be indexed, but a prefix length must be given http://dev.mysql.com/doc/refman/5.0/en/create-index.html)
1) create index `IDX_AutoroutePartRecord_DisplayAlias` on `Orchard_Autoroute_AutoroutePartRecord` (DisplayAlias(10))
2) create index `IDX_RecipeStepResultRecord_ExecutionId_StepName` on `Orchard_Recipes_RecipeStepResultRecord` (ExecutionId(10), StepName(10))
3)create index `IDX_MediaPartRecord_FolderPath` on `Orchard_MediaLibrary_MediaPartRecord` (FolderPath(10))
690 total views, 1 views today
At times we resort to the use of LocalDB, which in definition is a light weight version of the SQL Server Express, which loads itself on demand (i.e., whenever the application tries to read data using SQLConnection or through EntityFramework etc.,). The db itself can be created by right clicking on the App_Data folder and selecting Add->SQL Server database option from Visual Studio Solution Explorer. Once created the .mdf file resides in the App_Data folder and can be accessed via the Server Explorer (which acts as the conduit) to perform mundane db operations such as create/alter table, open query window etc.,
When we employ EF as the ORM to access data, it doesnt work as straight forward as it does with SQL Server based backend options. One common error that you may see is the below error (as given in the screenshot):
1,001 total views, 1 views today
Some time back, when I was fairly new to Office 365 & SharePoint Online, for the sake of learning I had provisioned a demo site and playing around with it. At that time, I didn’t know the importance of the SharePoint Online root site and started noticing that my SharePoint instance had started to act weird. Upon further investigation found that the root/default site is not an isolated site after all, and that its existence is very important to the overall health of all other sites provisioned in that tenant.
The below are some facts as to why its better to leave the root site “untouched” and leave it in its own pristine condition:
- Do not ever delete the Root site : If you ever are required to delete the site or had accidentally deleted it, all other SharePoint sites in that tenant will cease to work. This is because of the fact that the “default/root” site is used for some kind of authentication mechanism (before allowing users to sign-in to other sites) and that is very important for it to be available at all times.
- Missing Site Settings in the Default/Root Site: In the root site, if you navigate to “Site Settings” you would notice that some of the most common links would have gone missing such as Themes, Composed Looks, Save as Site Template, Delete Site etc., Even though you are the “Global Adminstrator” / “Site Collection Administrator / Owner”, it would still not be available and this is due to the fact that “Custom Scripts” are not enable in Root site”.
- Custom Scripts Not Enabled in Root site: By design Microsoft has turned off the option to run “Custom Scripts” in the default site, for the sake of preventing users from adding scripts in their My Sites, which could have ill effects on the overall health of the tenant. It should also be noted that “My Sites” are dependent on the root site and use the settings as applied on the root site for enforcing it onto itself as well.
- Cannot create a Default/Root site using PowerShell : Microsoft has disabled provisioning root sites in SharePoint Online using Powershell and it can only be created through the “SharePoint Admin Center”.
- At times, when you try to re-provision a root/default site (which you have deleted for some reason), even after you select the “Permanently delete the site collection from the recycle bin and continue“, it might still throw an error saying that the “A site with that name already exists”. In such instances, you simply have to wait for 1 or 2 hours for it to complete its pending activities.
Taking into consideration the above effects, its advisable to create new sites and perform customizations on them, rather to work directly on the root site. Not sure as to why Microsoft documentation doesn’t warn about its effects, but from all practical purpose, its better if we plan the site hierarchy by including a “\sites” or “\teams” in the URL (which gets added when provisioning new sites in the admin center).
1,505 total views, 1 views today
One of the short-comings of SharePoint Online is its inability to provide an option for SharePoint Administrators to perform/avail a site backup. Too often when we are done with a site and if we wish to have a backup of the site (just in case of restoring it or to create a new site based off on it.. ), its simply not possible in SharePoint Online.
The one other option available is to leverage the “Save as Site Template” option and create a copy of the site template (with/without data), which can then be re-used for provisioning new sub-sites within an existing top level site collection. However, what if we need to provision a new site from the “SharePoint Admin Center” and use that custom site template? (as you would have noticed that the “Provision new Site collection” menu doesn’t offer any option to list/pick any custom Site Template in its UI.)
820 total views, 1 views today