Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is rename refactoring working for somebody in strongly typed razor views?

Tags:

I have a model that looks like this:

public class Person {      public string PostalCode {get;set;} } 

Then I have a razor view

@model MvcApp1.Person  Your location is: @Model.PostalCode 

When I am using Visual Studio's 2010 rename refactoring (Ctrl+R,R) the property gets renamed on the model class, but stays the same in the view.

My understanding is that since the view is strongly typed, renaming should have also happened in the view.

What am I doing wrong?

like image 490
Oleg D. Avatar asked Apr 18 '11 22:04

Oleg D.


People also ask

What is rename refactoring?

Use the Rename refactoring to change names of symbols, files, directories, packages, modules and all the references to them throughout code. Renaming local variables or private methods can be done easily inline since only the limited scope is affected.

How do I rename all references in Visual Studio?

Select Edit > Refactor > Rename. Right-click the code and select Rename.

How do I rename a variable in Visual Studio code?

Press F2 and then type the new desired name and press Enter. All usages of the symbol will be renamed, across files.


1 Answers

VS's refactoring engine doesn't support Razor.

like image 129
SLaks Avatar answered Sep 29 '22 01:09

SLaks