Search This Blog

Thursday, July 1, 2021

Q46-Q50

Q46.  If we have 3 types of constructor in code static, default, parametrized. In which order they will be called. 
Q47. What is GAC?
Q48. Different state management options available in asp.net? 
Q49.  What is Data Annotation in MVC?
Q50. What is the difference between html.partial and html.renderPartial in mvc?



============================================================================
Q46.  If we have 3 types of constructor in code static, default, parametrized. In which order they will be called. 

Answer:
Static constructor will be called first and then depending upon object creation. 
============================================================================
Q47. What is GAC?

Answer:
GAC stands for Global Assembly CacheGAC is the place where shared assemblies get stored in a system.In order to install an assembly to GAC one needs to use the command : gacutil.exe i Assembly name 

============================================================================
Q48. Different state management options available in asp.net? 

Answer:
State management maintains and stores the information of any user till the end of the user session.

1. Server Side
  1. Sessions state
  2. Application State
  3. Cache   
2. Client Side
  1. Cookie
  2. Hidden field
  3. Query strings
  4. Local Storage

============================================================================
Q49.  What is Data Annotation in MVC?

Answer:
Data Annotations are certain validations that we put in our models to validate the input from the users.

Required
[Required(ErrorMessage="Please enter name"),MaxLength(30)]

Range
[Range(100,500,ErrorMessage="Please enter correct value")]

StringLength
[StringLength(30,ErrorMessage="Do not enter more than 30 characters")]

DisplayName
Using this attribute we can specify property name to be displayed on view.
[Display(Name="Student Name")]

MaxLength
[MaxLength(3)]

Bind
This attribute specifies fields to include or exclude for model binding.
[Bind(Exclude = "StudentID")]

DisplayFormat
This attribute allows us to set date in the format specified as per the attribute.
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}")]

RegularExpression
[RegularExpression(@"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", ErrorMessage = "Email is not valid.")]

DataType
[DataType(DataType.Text)]

============================================================================
Q50. What is the difference between html.partial and html.renderPartial in mvc?

Answer:
At end both give us the same result but the way they give result behind the scene is different. 
in case of html.partial we get html data which can be stored in a variable and we could play around that html. 
In case of html.renderedpartial we directly render the html content by stream and it can not be tempered. 



============================================================================

Q46-Q50

Q46.  If we have 3 types of constructor in code static, default, parametrized. In which order they will be called.  Q47. What is GAC? Q48.  ...