Optimum performance in tag (keyword) feature implementation in ASP.NET MVC

andypopa

I have an ASP.NET MVC application with a Microsoft SQL Server database accessed through Entity Framework. I want to implement a tag/hashtag/keyword feature. I have multiple types of objects in the application, but all of them will have tags and one will be able to search and find them using these tags.

I am confused about how to implement this feature.

Here are some ways I thought about: 1. Currently, the IDs for each object are ints that range from 0 to n. This is a problem because ID 1156 could refer to multiple objects: Row 1156 in Table1, Row 1156 in Table2. Should I change the implementation of the IDs to string GUIDs?

  1. Should I create a table for the tags and a separate table to relate the keywords to the objects? (TagGuid, ObjectGuid). This implementation would necessitate another query to find the objects.

  2. Should I just create a column in each table named Tags and list the tabs as strings? "tag1 tag2 tag3"? How would this impact performance as far as the duration of a search query goes? What if need to count the objects residing under a certain tag?

Looking for other possible solutions as well. Apologies for the vagueness, I don't know where to start - I could just go for either implementation but I think there's maybe a consacrated way of doing this task.

Aydin

Create a separate table for your Hash-tags and have multiple foreign keys to your other tables.

So imagine this...

Table > Hashtag
        Col > HashtagId
        Col > Tag
        Col > ThreadId
        Col > CommentId

etc...

If you make your Foreign keys optional, when using EF to query your data source you can filter your results using.

var commentHashtags = DbSource.Hashtags.Where(tag => tag.CommentId != (int?)null);

Wherever the CommentId isn't null, the other columns will be, unless of course you fill more than one of the Foreign Key columns in a single row.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

QueryString with ASP.NET MVC 6 Anchor Tag Helper

Select Tag Helper in ASP.NET Core MVC

How do I improve ASP.NET MVC application performance?

Including an anchor tag in an ASP.NET MVC Html.ActionLink

ASP.NET MVC Identity Default Implementation

What is the advantage of using Tag Helpers in ASP.NET Core MVC

Dependency injection causing poor performance (ASP.NET MVC)

Is there a feature to use for AngularJS in ASP.NET MVC to be strongly typed?

Radio Button Tag Helpers in ASP.NET 5 MVC 6

Slow DisplayFor performance in ASP.NET Core MVC

AutoMapper implementation in ASP.NET Core MVC

HttpClient Singleton Implementation in ASP.NET MVC

ASP.NET MVC textarea tag helper for ntext property is not working

Effective implementation of ASP .NET MVC + Dynamics 365

Progressive web app implementation in ASP.NET MVC

Troubleshooting LINQ Query Performance in ASP.NET MVC

SAML 2.0 implementation in ASP.Net MVC 4 as IDP

SQL Server and ASP.NET MVC performance Issue

ASP.NET MVC4... is "BIN" a reserved keyword?

Asp.net MVC real time application performance

How to improve the performance of ASP.NET MVC Web Application?

section scripts vs script-tag in asp.net mvc

Keyword not supported using ASP.NET MVC

ASP.NET MVC5 Identity Implementation

Performance diagnostics of an ASP .NET MVC 5 website

Porting a class implementation from asp.net mvc to asp.net mvc core

Hyperlink is lost using <a> tag in ASP.NET MVC view

Keyword not supported: 'port' error in ASP.NET MVC application

ASP.NET Core MVC. Implementation of the IDataProtectionKeyContext interface