|
yes sir i found it. please have a look at this url Donut Hole Caching in ASP.NET MVC - Dotnet Helpers[^]
the above url show how to use donut caching
[OutputCache(Duration = 60)]
public ActionResult LoadNewsFeed()
{
ViewBag.CurrentDataTimeMessage = DateTime.Now.ToString();
return View();
}
they said they are using Donut Caching but used OutputCache attribute....is it right?
this link c# - Donut caching _Layout with mvcdonutcaching ASP.NET MVC - Stack Overflow[^] is saying
use [DonutOutputCache]. please guide me because i am new in Donut Caching.
which attribute i need to use for Donut Caching ?
in so many article i saw people are talking about Donut Caching but they are using OutputCache attribute....reason not clear.
thanks
|
|
|
|
|
The person in that post is using a third-party library to implement donut caching (I don't think it is supported natively but I might be wrong). Different libraries will have different implementation techniques, some much use new attributes, some might use parameters on helper methods etc. Just pick a library that does what you need and follow its implementation instructions.
|
|
|
|
|
yes Donut Caching is 3rd party.
i read few articles on Donut Caching but observe a weird things that article talking about Donut Caching but using OutputCache attribute which is related to asp.net mvc built-in caching.
they should use [DonutOutputCache] attribute when they are talking about Donut Caching.
can you tell me why they use OutputCache attribute when talking about Donut Caching ?
|
|
|
|
|
Mou_kol wrote: can you tell me why they use OutputCache attribute when talking about Donut Caching ?
Because in the context of ASP.NET, you will be using a combination of ChildActionOnly and OutputCache attributes to implement the "Donut Caching" technique.
|
|
|
|
|
Don't confuse yourself with the naming. Donut Hole Caching is a server-side caching technique in which the some portion of tge page is cached.
The tools for implementing donut hole caching are relatively simple: You just need the HtmlHelper ’s Action method and Partial Views . In the context of ASP.NET , you can implement the "donut caching" technique using a combination of ChildActionOnly and OutputCache attributes.
So the following code is actually implemeting a donut hole caching technique:
[ChildActionOnly]
[OutputCache(Duration = 10)]
public PartialViewResult PartialViewCacheChild()
{
return PartialView("_PartialViewForCache");
}
Fore more information, read: Speed Up Your ASP.NET MVC Application with Doughnut Hole Caching -- Visual Studio Magazine[^]
modified 21-May-18 22:32pm.
|
|
|
|
|
i like to know when we will be using donut hole caching then we do not have to use this attribute
[DonutOutputCache] am i right?
when i need to use this attribute
[DonutOutputCache] ?
thanks
|
|
|
|
|
|
Can anyone suggest me the proper ocr format for extracting a single block of text from image using c#.??
|
|
|
|
|
Anyone playing with Blazor here?
Having thoughts and experience you could share?
|
|
|
|
|
I've read about it but I haven't done any hands-on coding with it. It seems interesting to me and I'd like to try it out. I'll give you an update or perhaps make an article about it after trying it out.
|
|
|
|
|
I tried the getting started but all I got was a white page, with the <Router> tag in it, i.e. did not execute / expand to the full page with page content ...
I guess I will try again with 0.4 ...
Despite that, I'd say it looks promising!
I wonder how easy it will be to call a JavaScript API. I know they have interop (read about it). But if said API has zillion of method, like GoogleMap for example, I wonder how tedious it's gonna be...
|
|
|
|
|
Super Lloyd wrote: but all I got was a white page, with the <Router> tag in it, i.e. did not execute / expand to the full page with page content ...
Perhaps it has something to do with the version you used. Have you tried upgrading to the latest? See this short discussion here: https://github.com/aspnet/Blazor/issues/635
|
|
|
|
|
|
You bet! Goodluck with your exploration.
Now I'm excited to get my hands dirty with Blazor too.
|
|
|
|
|
And... it's now working!
Will study JavaScript interop later this week.. which is the feature the I wonder most about..
Everything else looks pretty slick yet obvious (for an MVVM, and VueJS addict that I am)!
Mm... better JS interop seems to be a TOD..
Javascript interop documentation · Issue #348 · aspnet/Blazor · GitHub
I hope they don't stick with the "current approach" where one has to laboriously do the foolowing for every single function:
// register
Blazor.registerFunction('doPrompt', message => {
return prompt(message);
});
// wrap
public static bool DoPrompt(string message)
{
return RegisteredFunction.Invoke<bool>("doPrompt", message);
}
modified 22-May-18 11:29am.
|
|
|
|
|
I have a question regarding Gridview in asp.net. I need Textbox for particular cell in Gridview column. I am using Visual studio 2015. Whether it is possible.
|
|
|
|
|
You already posted this vague question at [^]. Please post in one forum only.
|
|
|
|
|
|
For example, you can order dishes on handheld devices that run on your Iphone, Androi, winphone, restaurant, coffee shop, and so on. Any programming language that runs on the above devices, for example simple you have to share yourself with.
|
|
|
|
|
|
Hello, new here. I am having some difficulty with claims Identity. The new Item that i have put in the "Add custom user claims here" could be a null or unanswered field during registration. It seems that it does not like that. I am getting a "Object reference not set to an instance of an object". This has no issue when the field in the database has something in it. Below is my code in the IdentityModel.
public string HomeTown { get; set; }
public DateTime? BirthDate { get; set; }
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
userIdentity.AddClaim(new Claim("BirthDate", BirthDate.ToString()));
userIdentity.AddClaim(new Claim("HomeTown", HomeTown.ToString()));
return userIdentity;
}
I have also implemented a IdentityExtensions.cs so that i can pull a GetHomeTown.
I am trying to show HomeTown on the _loginPartial of the MVC. I have tried several flavors of "if" statements. So i am trying to show a actionlink if the there is not a HomeTown in the system and if there is show it.
Here is my code for _loginPartial:
@{
var bday = (User.Identity.GetBirthDate());
var d = Convert.ToDateTime(bday).Date.ToString("d");
var htown = (User.Identity.GetHomeTown());
if (string.IsNullOrEmpty(htown))
{
<li> @Html.ActionLink("Update Info", "Update", "Home")</li>
}
else
{
<li>From @Html.Raw(htown) </li>
}
}
<li>@Html.Raw(d)</li>
Here is the code from the IdentityExtensions:
public static string GetHomeTown(this IIdentity identity)
{
var claim = ((ClaimsIdentity)identity).FindFirst("HomeTown");
return (claim != null) ? claim.Value : string.Empty;
}
I have no issues displaying GetHomeTown when there is something in the field. My "if" statements seem to never work. Some that i have tried will show whatever i put after the "if" statement and just ignore the else. Others do not work at all.
Is there something i am not getting here? Should i be doing this in the AccountController instead and where would i put this if i did?
Maybe in here:
public AccountController()
{
context = new ApplicationDbContext();
}
Thanks in advance for your help. Let me know if there is anything else that you need to see.
Update 12:08 EST 5/5/2018:
I was able to get around this by inserting a default value - html string. This way i do not need the "if" statement and it displays what i need with a link. When the user updates this with a Home Town it will delete the string and show their hometown. I think this is better anyhow.
I did however find out that my code does work if you clear the NULL from the SQL record field to an empty field. I tried putting a default value of ("") but SQL treats it as NULL in the field.
modified 5-May-18 0:15am.
|
|
|
|
|
I figured that since MVC does so much for you that this would be an easy one. However, I can't find a complete solution to do this. I want my index views and detail views, in particular, to display local time instead of UTC time. Or, I will happily hard code Eastern Time since all users are in Eastern time right now. The database stores the values in UTC and the site will be running in Azure.
Does anyone have a good solution for this? How do you all handle displaying times in a different timezone?
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Something like this should work:
Views/Shared/DisplayTemplates/DateTime.cshtml:
@model DateTime?
if (Model != null)
{
string formatString = ViewData.ModelMetadata.DisplayFormatString;
if (string.IsNullOrWhiteSpace(formatString))
{
formatString = "{0:r}";
}
<time datetime="@string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:o}", Model)">@string.Format(System.Globalization.CultureInfo.CurrentCulture, formatString, Model?.ToLocalTime())</time>
} Views/Shared/DisplayTemplates/DateTimeOffset.cshtml:
@model DateTimeOffset?
if (Model != null)
{
string formatString = ViewData.ModelMetadata.DisplayFormatString;
if (string.IsNullOrWhiteSpace(formatString))
{
formatString = "{0:r}";
}
<time datetime="@string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:o}", Model)">@string.Format(System.Globalization.CultureInfo.CurrentCulture, formatString, Model?.ToLocalTime())</time>
}
NB: This will use the server's local time zone, not the client's. If you want to use the client's, then you'll need to use Javascript to update the <time> elements. For example, using Moment.js[^]:
$(function () {
$("time").each(function () {
var me = $(this);
var time = me.prop("dateTime");
if (time) {
var value = moment.utc(time);
me.html(value.calendar());
me.prop("title", value.format("LLLL"));
}
});
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
We have a CPPLUS DVR with 2 way audio setup. We want to develop the web application, through which we have to integrate the DVR and can listen the audio remotely.
If anyone has a solution, please share.
|
|
|
|
|
please help i am getting the error message:
System.ArgumentException: AjaxControlToolkit.RatingExtender missing required StarCssClass property value for Rating2_RatingExtender.
Parameter name: StarCssClass
<title></title>
<style type="text/css">
.Star
body
{
font-family: Arial;
font-size: 10pt;
display: block;
background-repeat: no-repeat;
}
th, td
{
height: 30px;
width: 100px;
}
</style>
<style type="text/css">
.Star
{
background-image: url(images1/Star.gif);
height: 17px;
width: 17px;
}
.WaitingStar
{
background-image: url(images1/WaitingStar.gif);
height: 17px;
width: 17px;
}
.FilledStar
{
background-image: url(images1/FilledStar.gif);
height: 17px;
width: 17px;
Display:Block;
background-repeat:no-repeat;
}
</style>
</head>
<body>
|
|
|
|