Search Results

Search found 103627 results on 4146 pages for 'google code'.

Page 21/4146 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Google Maps API - Marker not showing

    - by popnbrown
    I'm trying to add markers for every single row from a table, that sits on the page. The page is http://www.sravanks.com/first/2013ftcmap.php This is the JS code that's loading the markers: $(document).ready(function() { var mapOptions = { center: new google.maps.LatLng(39.740, -89.503), zoom: 7 }; var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); var infowindow = new google.maps.InfoWindow(); /* City Markers */ var cityCircle = new Array(); var i = 0; $.each($('.events tr'), function(index, value) { var name = $(this).find('td:first()').html(); var address = $(this).find('.address').html(); var linkUrl = "http://www.sravanks.com/first/geocode.php?address=" + address; $.ajax({ url: linkUrl }).done(function(data){ var json = $.parseJSON(data.substring(0, data.length-1)); lat = json.results[0].geometry.location.lat; lng = json.results[0].geometry.location.lng; var latlng = new google.maps.LatLng(lat, lng); var marker = new google.maps.Marker({ position: latlng, map: map, icon: 'map-pointer-medium.gif' }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(name); infowindow.open(map, marker); cityCircle[i] = new google.maps.Circle({strokeColor: '#00FF00', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#00FF00', fillOpacity: 0.35, map: map, center: latlng, radius: 144841}); i++; }); }); }); /*Team Markers*/ var markers = {}; var teamName, teamNumber, lat, lng, content; $.each($('.list tr'), function(index, value) { teamName = $(this).find('td.name').html(); teamNumber = $(this).find('td.number').html(); markers[teamNumber] = {}; lat = parseFloat($(this).find('td.lat').html()); lng = parseFloat($(this).find('td.lng').html()); content = "Name: " + teamName + "<br />Number: " + teamNumber; markers[teamNumber]['latlng'] = new google.maps.LatLng(lat, lng); markers[teamNumber]['marker'] = new google.maps.Marker({ position: markers[teamNumber]['latlng'], map: map }); google.maps.event.addListener(markers[teamNumber]['marker'], 'click', function() { infowindow.setContent(content); infowindow.open(map, markers[teamNumber]['marker']); }); }); google.maps.event.addListener(infowindow, 'closeclick', function() { for(var i=0;i<cityCircle.length;i++){ cityCircle[i].setMap(null); } }); }); I've got no errors, but the Team Markers do not show up. The strange thing is that the City Markers do show up. Some more info, the City Markers ajax call is just to a proxy that calls the google geocoding api. Again the link's at http://www.sravanks.com/first/2013ftcmap.php

    Read the article

  • The Evolution of Search: A History of Google Search [Video]

    - by Jason Fitzpatrick
    Internet search has changed enormously in the last decade; this video tour of Google evolving search strategies shows us where we’ve been and where we’re going. In the above video Google staff reflect on the last decade of search, innovations at Google, and where they’re taking the search engine experience in the future. While the video clearly has a Google bias (they produced it after all) it’s still an interesting look at how Google and internet search as a whole have changed over the years. The Evolution of Search in Six Minutes [The Official Google Blog] How to See What Web Sites Your Computer is Secretly Connecting To HTG Explains: When Do You Need to Update Your Drivers? How to Make the Kindle Fire Silk Browser *Actually* Fast!

    Read the article

  • Dissection of Google indexing services

    - by Pankaj Upadhyay
    There are more than a few questions that hop into mind when someone thinks about Google's indexing services. Jeff Atwood wrote about them at The Elephant in the Room: Google Monoculture and Trouble In the House of Google. I have two questions: How does google index dynamic websites? This site has dynamic pages, QUESTIONS, TAGS, USERS, BADGES, UNANSWERED, ASK QUESTION. The content of these pages is dynamically generated, therefore we access the dynamic content and not the physical files on the server. But how does Google shows every question of the site or other dynamic websites? What does Google index and keep on its servers? Does it copy the complete page into its server or just the title, meta tags and body?

    Read the article

  • Add a non-Google Tasks List to Chrome

    - by Asian Angel
    Most people rely on a task list to help them remember what they need to do but not everyone wants one that is tied to a Google account. If you have been wanting an independent tasks list then join us as we look at the Tasks extension for Google Chrome. Tasks in Action As soon as you have finished installing the extension you are ready to start adding new tasks to your list. Enter your task into the “Text Area” and press “Enter” to add the task to the list. Note: Your tasks list will be retained (in the order you set) when you close and then reopen your browser. In just moments you can have your task list ready to go. Notice that there is also a “numerical indicator” attached to the “Toolbar Button” so that you will always know how many tasks you have left to complete. You can use the “drag and drop” function to rearrange your list into a more proper order if needed. When you are finished with a task all that you will need to do is click on the “Checkmark” to remove it from the list. If you need to make a new entry similar to an existing one simply right click and the text is automatically pasted into the “Text Area”. Make any desired changes and press “Enter” to add your new task to the list. Prefer to skip using the drop-down window? Click on “Tasks” at the top to open your list in a new tab instead. The tasks list looked very nice in our new tab. Being able to use the style that best suits your needs makes this a very convenient extension. Conclusion The Tasks extension is a perfect fit for anyone who needs a tasks list available but does not want to be tied down with an online account. Quick, simple and best of all hassle free. Links Download the Tasks extension (Google Chrome Extensions) Similar Articles Productive Geek Tips Turn Chrome’s New Tab Page into a Google Tasks PageAccess Google Tasks in Chrome the Easy WayHow to Make Google Chrome Your Default BrowserAdd a To-Do List to Chrome’s New Tab PageAccess Remember The Milk in Google Chrome the Easy Way TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 PCmover Professional Test Drive Mobile Phones Online With TryPhone Ben & Jerry’s Free Cone Day, 3/23/10 New Stinger from McAfee Helps Remove ‘FakeAlert’ Threats Google Apps Marketplace: Tools & Services For Google Apps Users Get News Quick and Precise With Newser Scan for Viruses in Ubuntu using ClamAV

    Read the article

  • How To Use Google Drive on Linux: 2 Unofficial Solutions

    - by Chris Hoffman
    When Google announced Google Drive, they promised Linux support. That was about 7 months ago. While Google said Google Drive for Linux was “still a priority” back in July, it seems it’s no longer a priority. If you want to use Google Drive on Linux, both Insync and grive can bring Google Drive to Linux. They’re not official, but they’re better than nothing if you’re waiting for an official client. How To Boot Your Android Phone or Tablet Into Safe Mode HTG Explains: Does Your Android Phone Need an Antivirus? How To Use USB Drives With the Nexus 7 and Other Android Devices

    Read the article

  • Will rewriting your .htaccess to 404 to return search results from your site negatively effect your ranking in Google?

    - by leeand00
    Depending on the type of site that you are running, it may or may not be advantageous to display search results instead of a 404 page, when someone visits a non-existent page on your site. I believe that the site I've been maintaining recently would benefit from this as it is the site of a publication. With a publication the more people you can get to read your site the better. But after reading up on how Google ranks the "quality" of your site, where you will appear in SERPs, based on how much the meta text of a page relates to the content of the page, I have to wonder if making a 404 page link to the search results would harm the "quality" of your site in Google eyes.

    Read the article

  • How to make google analytics report on two domains as though they are one site?

    - by Ben
    We have a main site that Google analytics is currently running fine on (www.ourcompany.com). We have a page that is technically part of the site (same design, etc.) but is hosted on another server/domain for various business reasons (www.ourparentcompany.com/ourcompanyapp/). Do we just add the normal google analytics code to the bottom of that page? Or is there something more we have to do? If there isn't anything more then couldn't anyone just take your GA code and start reporting analytics to your profile from their site?

    Read the article

  • Google's process for publishing/modifying pages [closed]

    - by Glenn Dayton
    I'm assuming that a group of people at Google have control of certain sections of google.com, but how does Google make sure that employees don't accidentally or intentionally sabotage the website? Does Google use Adobe Contribute or some similar product for sharing/publishing the website. Do employees use WebDAV, FTP, SFTP, or SSH to publish the site. Since Google has hundreds of thousands of servers it probably takes some time for its servers to update. Do they transmit the new copy of the website to all servers before publishing at once? This question does not apply to Google editing a database and having a page reflect the database's changes. It applies to employees editing the source code and/ or back end of the site.

    Read the article

  • The new Google Analytics - what new useful features have you found?

    - by Rob
    If you don't know already a new version of Google Analytics has just come out. On first initial views it doesn't seem like much of an improvement on the previous version. There's lot's linking to Google's social stats but I'm yet to see the value of that. Also it doesn't seem to make the best use of the important data, it's tending to push referral sites, keywords to the back and bring the less important data to the front. Is that a sign of things to come??? One feature I did find interesting was the visitors flow as it shows the visitors path through your site. What new features have you found useful/interesting?

    Read the article

  • Is it possible to transfer Google Authorship?

    - by Stephanus Yanaputra
    Is it possible to transfer Google Authorship from one account to another? Scenario: I have user A who is a legitimate Google Author in my WordPress site. When I search the 'keyword' in Google, his name and photo will show up in the search result. One day A left the company, so we don't want to use his name again as an author, and transfer it to another person which is B. Technically speaking, I can just alter the display name and Google+ Profile URL of A to B. And then I probably can notify Google of the changes happening. But what will happen then? Will Google get confused and think that I'm doing scam? Is doing this action even correct in the first place?

    Read the article

  • Why google isn't updating my site title in search results? [closed]

    - by SharkTheDark
    Possible Duplicate: Google doesn't seem to update the description or title of my homepage I had my domain for few days before I uploaded site to it, and it had one title, and then when I uploaded content it should get new title, but with my misunderstanding of WordPress it had blocked robots.txt and keyword with no-index and no-follow. But I removed that like 7 days ago, and I see in reports that Google bot is crawling over my site, but my site title isn't updating, it still has old domain title when site wasn't there... My robots.txt has now: User-agent: * Allow: / I have clear title tag on every page. How long does it take to update? Do I need to check something else?

    Read the article

  • Adding users to multiple/all sites in Google Webmaster Tools?

    - by Christian
    I didn't find an answer to this, but maybe I didn't use the right terms for my search. So I'm sorry if this is a duplicate. Anyway, my situation is this: the company I work at manages a lot of sites (100+), and we've recently put them all into Google Webmaster Tools under my Google account, which was tedious enough. Now two coworkers are supposed to be added as users for each site, so they can see the data and manage stuff there as well. But I can only find an option to add users for a single site, not for all sites that are currently associated with my account. Do I really have to go through more than a hundred sites one by one and add the two users to each of them, or is there some way to add both users to all/multiple sites at once?

    Read the article

  • Turn Off Google Chrome Annoying Link Hover

    - by Volomike
    I like Google Chrome a lot, but there are two problems I have with it. The Address Bar search history feature that I want to turn off, and the feature where I hover over a hyperlink and in the bottom lefthand corner it shows a light blue hover tooltip about where that link goes. I really don't care where a given link goes and wish I could turn that feature off, even if I have to install a Google Chrome Extension. So, for these two reasons, I will not install Google Chrome as my primary browser and will remain with Firefox. So, is there a fix to turn the annoying link hover tooltip feature off?

    Read the article

  • Have to enter google sites through second-level domain

    - by Anton Geraschenko
    I'm having the same problem as this guy. I own two domains hosted on google sites, mydomain.com and mydomain.net. When I go to mydomain.com, it redirects me to the site located at www.mydomain.com (this is the desired behavior). This used to also work on mydomain.net, but now when I go to mydomain.net, I get a Google 404. To see the content, I have to go to www.mydomain.net. As far as I can tell, the DNS settings and Google apps settings for both domains are identical. Does anybody have any idea about what could be happening?

    Read the article

  • Removing bing from my google search bar when I open a new tab

    - by user329869
    Bing has rudely planted its self on my "open new tab" so above bing my regular google is there but below is the irritating bing search bar! I have tried everything I know of to get rid of it and it will not go! I can not find it listed under my settings, control panel and/or uninstall! This is the second time bing has made its unwelcome tush comfy in my google area! How frustrating! I miss my mac book pro! Removing bing from my google search bar when I open a new tab.

    Read the article

  • QR Codes for Files on Google Code

    - by Synetech inc.
    Hi, When you download files from Google Code now (example), in addition to the text version of the SHA1 hash, it includes a QR code of it. The device that the file was downloaded to is the one that has to hash the file. But, if it can download the file (ie, has access to the webpage), it also has access to the text version of the hash, so the QR code seems completely useless—and more work to decode when the raw text is available. How would reading the hash into a mobile phone allow you to verify the file you download to the computer? Or if you download the file to the phone, how would you use the phone to take a picture of the QR code displayed on the webpage on its own screen? Does anyone know what the point to the QR code is or how you would use it to verify the downloaded file (I don’t mean QR codes in general, but specifically in this context).

    Read the article

  • Google Apps for Business on a separate infrastructure?

    - by dustin
    Does anyone know if Google Apps for Business edition hosts the apps (gmail, calendar, etc.) on a physically separate infrastructure than the Standard (free) infrastructure? We've been growing increasingly annoyed with the lost/severely delayed email messages, downtime, etc. of Google Apps (standard) over time, and we are wondering if moving to the paid version would bring any benefits. Specifically, if the Business edition is not in some way on a different physical infrastructure, and we are in essence paying for a few small perks but still run on the usual standard/free setup, then we would probably have the same (or just as many) issues with the Business version. I've emailed Google's sales team responsible for GApps, but haven't heard anything back in 4 days, which already doesn't speak well for the service. So, anyone have any insight into this? Thanks in advance for any and all help :)

    Read the article

  • Import Google Voice Contacts Into iPhone

    - by Nalandial
    What I'd like to do is have my Google Voice contacts available on my iPhone, not the other way around. I recently had to restore the phone to factory defaults and it's a pain to manually enter all them all. When I make a new GMail e-mail account on my iPhone it won't let me import contacts from my Google account, but even if it did I don't want every single contact in my phone. Google for some reason adds every single person I've ever sent e-mails to into my contacts list, which as you can imagine is quite a large list by now. Does anyone have any suggestions for how to do this?

    Read the article

  • How To: Transfer Categories in Outlook 2007 from One Installation to Another Using Google Sync

    - by nicorellius
    I use Outlook 2007 for email. I also happen to use the categories for organizing my mail. This function is cool, because you can use keyboard shortcuts that make categorizing mail quick and easy. The problem I am having is that, since I use Google Apps Sync at home and at work, I can't seem to figure out how to transfer the existing category assignments that I spent months creating at work. As my email comes and goes, I assign this and that, with thousands of messages all belonging to specific categories. When I finally installed and started using Google Apps Sync at home, the synchronization process works great, but all my messages are blank, i.e., don't have the color categories I assigned at work. What's worse, I actually changed computers at work, and now am facing the same problem on the new workstation. Using: Windows XP Pro, Outlook 2007, Google Apps. Anyone run into this and find a solution?

    Read the article

  • Google docs spreadsheet not loading

    - by Pythonista's Apprentice
    I have a Google spreadsheet with a lot of very important data and some scripts that where working well. At some point, the brownser crash and I reload the page. After that, I can't acess that (only that!) spreadsheet any more! I try it from other Google accounts but it doesn't work. All I get is the "Loading..." message in the brownser tab and nothing more (the loading process never completes). I also can't: copy the file or download it! Ie, I can lose all the information in my spreadsheet and also lose all my scripts! (I never think something like this could hapen with a Google Product) How can I solve this problem? Thanks in advance for any help!

    Read the article

  • Google Analytics - Google Adwords [closed]

    - by Fiona
    Hi there, I have a number of Google Analytics accounts. I also have one adwords account. At the moment I've linked my adwords to one of my GA accounts. However I'd like to link to my other GA accounts. Can this be done? and if so how? Thanks, Fiona

    Read the article

  • Inheritance Mapping Strategies with Entity Framework Code First CTP5 Part 1: Table per Hierarchy (TPH)

    - by mortezam
    A simple strategy for mapping classes to database tables might be “one table for every entity persistent class.” This approach sounds simple enough and, indeed, works well until we encounter inheritance. Inheritance is such a visible structural mismatch between the object-oriented and relational worlds because object-oriented systems model both “is a” and “has a” relationships. SQL-based models provide only "has a" relationships between entities; SQL database management systems don’t support type inheritance—and even when it’s available, it’s usually proprietary or incomplete. There are three different approaches to representing an inheritance hierarchy: Table per Hierarchy (TPH): Enable polymorphism by denormalizing the SQL schema, and utilize a type discriminator column that holds type information. Table per Type (TPT): Represent "is a" (inheritance) relationships as "has a" (foreign key) relationships. Table per Concrete class (TPC): Discard polymorphism and inheritance relationships completely from the SQL schema.I will explain each of these strategies in a series of posts and this one is dedicated to TPH. In this series we'll deeply dig into each of these strategies and will learn about "why" to choose them as well as "how" to implement them. Hopefully it will give you a better idea about which strategy to choose in a particular scenario. Inheritance Mapping with Entity Framework Code FirstAll of the inheritance mapping strategies that we discuss in this series will be implemented by EF Code First CTP5. The CTP5 build of the new EF Code First library has been released by ADO.NET team earlier this month. EF Code-First enables a pretty powerful code-centric development workflow for working with data. I’m a big fan of the EF Code First approach, and I’m pretty excited about a lot of productivity and power that it brings. When it comes to inheritance mapping, not only Code First fully supports all the strategies but also gives you ultimate flexibility to work with domain models that involves inheritance. The fluent API for inheritance mapping in CTP5 has been improved a lot and now it's more intuitive and concise in compare to CTP4. A Note For Those Who Follow Other Entity Framework ApproachesIf you are following EF's "Database First" or "Model First" approaches, I still recommend to read this series since although the implementation is Code First specific but the explanations around each of the strategies is perfectly applied to all approaches be it Code First or others. A Note For Those Who are New to Entity Framework and Code-FirstIf you choose to learn EF you've chosen well. If you choose to learn EF with Code First you've done even better. To get started, you can find a great walkthrough by Scott Guthrie here and another one by ADO.NET team here. In this post, I assume you already setup your machine to do Code First development and also that you are familiar with Code First fundamentals and basic concepts. You might also want to check out my other posts on EF Code First like Complex Types and Shared Primary Key Associations. A Top Down Development ScenarioThese posts take a top-down approach; it assumes that you’re starting with a domain model and trying to derive a new SQL schema. Therefore, we start with an existing domain model, implement it in C# and then let Code First create the database schema for us. However, the mapping strategies described are just as relevant if you’re working bottom up, starting with existing database tables. I’ll show some tricks along the way that help you dealing with nonperfect table layouts. Let’s start with the mapping of entity inheritance. -- The Domain ModelIn our domain model, we have a BillingDetail base class which is abstract (note the italic font on the UML class diagram below). We do allow various billing types and represent them as subclasses of BillingDetail class. As for now, we support CreditCard and BankAccount: Implement the Object Model with Code First As always, we start with the POCO classes. Note that in our DbContext, I only define one DbSet for the base class which is BillingDetail. Code First will find the other classes in the hierarchy based on Reachability Convention. public abstract class BillingDetail  {     public int BillingDetailId { get; set; }     public string Owner { get; set; }             public string Number { get; set; } } public class BankAccount : BillingDetail {     public string BankName { get; set; }     public string Swift { get; set; } } public class CreditCard : BillingDetail {     public int CardType { get; set; }                     public string ExpiryMonth { get; set; }     public string ExpiryYear { get; set; } } public class InheritanceMappingContext : DbContext {     public DbSet<BillingDetail> BillingDetails { get; set; } } This object model is all that is needed to enable inheritance with Code First. If you put this in your application you would be able to immediately start working with the database and do CRUD operations. Before going into details about how EF Code First maps this object model to the database, we need to learn about one of the core concepts of inheritance mapping: polymorphic and non-polymorphic queries. Polymorphic Queries LINQ to Entities and EntitySQL, as object-oriented query languages, both support polymorphic queries—that is, queries for instances of a class and all instances of its subclasses, respectively. For example, consider the following query: IQueryable<BillingDetail> linqQuery = from b in context.BillingDetails select b; List<BillingDetail> billingDetails = linqQuery.ToList(); Or the same query in EntitySQL: string eSqlQuery = @"SELECT VAlUE b FROM BillingDetails AS b"; ObjectQuery<BillingDetail> objectQuery = ((IObjectContextAdapter)context).ObjectContext                                                                          .CreateQuery<BillingDetail>(eSqlQuery); List<BillingDetail> billingDetails = objectQuery.ToList(); linqQuery and eSqlQuery are both polymorphic and return a list of objects of the type BillingDetail, which is an abstract class but the actual concrete objects in the list are of the subtypes of BillingDetail: CreditCard and BankAccount. Non-polymorphic QueriesAll LINQ to Entities and EntitySQL queries are polymorphic which return not only instances of the specific entity class to which it refers, but all subclasses of that class as well. On the other hand, Non-polymorphic queries are queries whose polymorphism is restricted and only returns instances of a particular subclass. In LINQ to Entities, this can be specified by using OfType<T>() Method. For example, the following query returns only instances of BankAccount: IQueryable<BankAccount> query = from b in context.BillingDetails.OfType<BankAccount>() select b; EntitySQL has OFTYPE operator that does the same thing: string eSqlQuery = @"SELECT VAlUE b FROM OFTYPE(BillingDetails, Model.BankAccount) AS b"; In fact, the above query with OFTYPE operator is a short form of the following query expression that uses TREAT and IS OF operators: string eSqlQuery = @"SELECT VAlUE TREAT(b as Model.BankAccount)                       FROM BillingDetails AS b                       WHERE b IS OF(Model.BankAccount)"; (Note that in the above query, Model.BankAccount is the fully qualified name for BankAccount class. You need to change "Model" with your own namespace name.) Table per Class Hierarchy (TPH)An entire class hierarchy can be mapped to a single table. This table includes columns for all properties of all classes in the hierarchy. The concrete subclass represented by a particular row is identified by the value of a type discriminator column. You don’t have to do anything special in Code First to enable TPH. It's the default inheritance mapping strategy: This mapping strategy is a winner in terms of both performance and simplicity. It’s the best-performing way to represent polymorphism—both polymorphic and nonpolymorphic queries perform well—and it’s even easy to implement by hand. Ad-hoc reporting is possible without complex joins or unions. Schema evolution is straightforward. Discriminator Column As you can see in the DB schema above, Code First has to add a special column to distinguish between persistent classes: the discriminator. This isn’t a property of the persistent class in our object model; it’s used internally by EF Code First. By default, the column name is "Discriminator", and its type is string. The values defaults to the persistent class names —in this case, “BankAccount” or “CreditCard”. EF Code First automatically sets and retrieves the discriminator values. TPH Requires Properties in SubClasses to be Nullable in the Database TPH has one major problem: Columns for properties declared by subclasses will be nullable in the database. For example, Code First created an (INT, NULL) column to map CardType property in CreditCard class. However, in a typical mapping scenario, Code First always creates an (INT, NOT NULL) column in the database for an int property in persistent class. But in this case, since BankAccount instance won’t have a CardType property, the CardType field must be NULL for that row so Code First creates an (INT, NULL) instead. If your subclasses each define several non-nullable properties, the loss of NOT NULL constraints may be a serious problem from the point of view of data integrity. TPH Violates the Third Normal FormAnother important issue is normalization. We’ve created functional dependencies between nonkey columns, violating the third normal form. Basically, the value of Discriminator column determines the corresponding values of the columns that belong to the subclasses (e.g. BankName) but Discriminator is not part of the primary key for the table. As always, denormalization for performance can be misleading, because it sacrifices long-term stability, maintainability, and the integrity of data for immediate gains that may be also achieved by proper optimization of the SQL execution plans (in other words, ask your DBA). Generated SQL QueryLet's take a look at the SQL statements that EF Code First sends to the database when we write queries in LINQ to Entities or EntitySQL. For example, the polymorphic query for BillingDetails that you saw, generates the following SQL statement: SELECT  [Extent1].[Discriminator] AS [Discriminator],  [Extent1].[BillingDetailId] AS [BillingDetailId],  [Extent1].[Owner] AS [Owner],  [Extent1].[Number] AS [Number],  [Extent1].[BankName] AS [BankName],  [Extent1].[Swift] AS [Swift],  [Extent1].[CardType] AS [CardType],  [Extent1].[ExpiryMonth] AS [ExpiryMonth],  [Extent1].[ExpiryYear] AS [ExpiryYear] FROM [dbo].[BillingDetails] AS [Extent1] WHERE [Extent1].[Discriminator] IN ('BankAccount','CreditCard') Or the non-polymorphic query for the BankAccount subclass generates this SQL statement: SELECT  [Extent1].[BillingDetailId] AS [BillingDetailId],  [Extent1].[Owner] AS [Owner],  [Extent1].[Number] AS [Number],  [Extent1].[BankName] AS [BankName],  [Extent1].[Swift] AS [Swift] FROM [dbo].[BillingDetails] AS [Extent1] WHERE [Extent1].[Discriminator] = 'BankAccount' Note how Code First adds a restriction on the discriminator column and also how it only selects those columns that belong to BankAccount entity. Change Discriminator Column Data Type and Values With Fluent API Sometimes, especially in legacy schemas, you need to override the conventions for the discriminator column so that Code First can work with the schema. The following fluent API code will change the discriminator column name to "BillingDetailType" and the values to "BA" and "CC" for BankAccount and CreditCard respectively: protected override void OnModelCreating(System.Data.Entity.ModelConfiguration.ModelBuilder modelBuilder) {     modelBuilder.Entity<BillingDetail>()                 .Map<BankAccount>(m => m.Requires("BillingDetailType").HasValue("BA"))                 .Map<CreditCard>(m => m.Requires("BillingDetailType").HasValue("CC")); } Also, changing the data type of discriminator column is interesting. In the above code, we passed strings to HasValue method but this method has been defined to accepts a type of object: public void HasValue(object value); Therefore, if for example we pass a value of type int to it then Code First not only use our desired values (i.e. 1 & 2) in the discriminator column but also changes the column type to be (INT, NOT NULL): modelBuilder.Entity<BillingDetail>()             .Map<BankAccount>(m => m.Requires("BillingDetailType").HasValue(1))             .Map<CreditCard>(m => m.Requires("BillingDetailType").HasValue(2)); SummaryIn this post we learned about Table per Hierarchy as the default mapping strategy in Code First. The disadvantages of the TPH strategy may be too serious for your design—after all, denormalized schemas can become a major burden in the long run. Your DBA may not like it at all. In the next post, we will learn about Table per Type (TPT) strategy that doesn’t expose you to this problem. References ADO.NET team blog Java Persistence with Hibernate book a { text-decoration: none; } a:visited { color: Blue; } .title { padding-bottom: 5px; font-family: Segoe UI; font-size: 11pt; font-weight: bold; padding-top: 15px; } .code, .typeName { font-family: consolas; } .typeName { color: #2b91af; } .padTop5 { padding-top: 5px; } .padTop10 { padding-top: 10px; } p.MsoNormal { margin-top: 0in; margin-right: 0in; margin-bottom: 10.0pt; margin-left: 0in; line-height: 115%; font-size: 11.0pt; font-family: "Calibri" , "sans-serif"; }

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >