How to put Multiple Markers in Google Map in MVC 4

source article:

* In my Controller, 
  public ActionResult Map()
    IEnumerable<Place> places = getAllPlaces();
    return View(places);

* In Map.cshtml razor view, 

@model IEnumerable<Place>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>

<script language="javascript" type="text/javascript">
   var map;    
   var mgr;    
   function initialize() {
        var myOptions = {
            zoom: 2,
            center: new google.maps.LatLng(0, 0),
            mapTypeId: google.maps.MapTypeId.HYBRID
        map = new google.maps.Map(document.getElementById("googleMap"), myOptions);
        mgr = new MarkerManager(map);
        var infoWindow = new google.maps.InfoWindow({ content: "contents" });
        google.maps.event.addListener(mgr, 'loaded', function () {
            @foreach (var place in Model) {
                var marker = new google.maps.Marker({
                    position: new google.maps.LatLng(@place.Latitude, @place.Longitude),
                    html: "@place.Link"

                google.maps.event.addListener(marker, "click", function () {
				    infoWindow.setContent(this.html);, this);

                mgr.addMarker(marker, 0);
    google.maps.event.addDomListener(window, 'load', initialize);

<div id="googleMap"></div>

Windows Azure Accelerator for Web Roles

From Windows Azure:

Windows Azure Code Samples, Toolkits, and Accelerators

Download it from GitHub

Nathan Totten’s articles:

1. Windows Azure Accelerator for Web Roles

2. Update on the Windows Azure Accelerators

Maarten’s article:

The Benefits of Windows Azure Accelerator for Web Roles



MSDN class page

SqlBulkCopy is useful especially to import bulk data ( ~= 600,000, e.g.) records from a SQL or another source to a designated table in a SQL server.

BUT if you do this in a EntityFramework environment in .NET framework, then you might want to have this structure for faster performance.

// set db config properties to false to disable all the auto-detect and auto-validation
dbContext.Configuration.AutoDetectChangesEnabled = false;
dbContext.Configuration.ValidateOnSaveEnabled = false;

// perform bulk copy to SQL
using(SqlBulkCopy myCopy = SqlBulkCopy(sqlConnStr))

myCopy.BatchSize = 100; // row number to send to the server as a batch proc.
myCopy.WriteToServer(your data here);

// Re-set db configuration properties to true.
dbContext.Configuration.AutoDetectChangesEnabled = true;
dbContext.Configuration.ValidateOnSaveEnabled = true;

For details re how to use SqlBulkCopy, pls refer to the MSDN page link at the top of this article. Hope this helps. 🙂