본문 바로가기
728x90
반응형

전체 글303

ASP.NET MVC] Web.config transform file Web.config transform file deploy시, Web.config 파일이 어떻게 수정되는지 지정하는 XML file이다. Transformation action은 XML-Document-Transform namespace에서 정의된 XML attribute(xdt prefix, Locator, Transform)를 사용하여 지정한다. XML attributes 1) Locator : Web.config element 지정, optional 2) Transform : Locator attribute가 찾은 element로 무엇을 할지 지정 Locator Attribute Syntax 1) Condition 2) Match 3) XPath Transform Attribute Syntax 1).. 2022. 7. 21.
C#] LINQ - Projection Linq에서 projection은 지속 사용할 properties만 담긴 새로운 object를 생성하는 작업이다. projection operations 1. Select 2. SelectMany class Bouquet { public List Flowers { get; set; } } static void SelectVsSelectMany() { List bouquets = new() { new Bouquet { Flowers = new List { "sunflower", "daisy", "daffodil", "larkspur" }}, new Bouquet { Flowers = new List { "tulip", "rose", "orchid" }}, new Bouquet { Flowers = new .. 2022. 7. 20.
C#] 반복자(Iterator), yield keyword yield Iterator는 yield라는 keyword를 사용한다. yield는 colleciton, array를 순회하며 호출한 함수에 element를 하나씩 반환한다. yield break를 사용하여 반복기를 종료할 수 있다. public static IEnumerable Fibonacci(int length) { int a = 0, b = 1; for (int i = 0; i < length; i++) { yield return a; //이 시점의 a가 반환된다. int c = a + b; a = b; b = c; } } static void Main(string[] args) { // Display the Fibonacci sequence up to the tenth number. foreach.. 2022. 7. 19.
C#] Delegates, Anonymous Methods and Lambda Expressions Delegates Anonymous functions (Anonymous methods & Lambda expressions) Delegates class Program { //Delegate defines the signature (return type and parameters) delegate void ArithmeticOperation(double operand1, double operand2); static void Addition(double number1, double number2) { Console.WriteLine($"{number1} + {number2} = {number1 + number2}"); } public static int RunAnotherMethod(ArithmeticO.. 2022. 7. 18.
ASP.NET MVC] RenderPartial, Partial, RenderAction, Action Partials 기본설정으로 _ViewStart가 적용되지 않아, layout을 사용하지 않는다. 필요시, 지정할 수 있다. action method를 호출하지 않는다. Partial view에 보낼 수 있는 model을 가지고 있을 때 사용한다. method : RenderPartial, Partial 두 method의 결과는 동일하다. 다른점은, RenderPartial은 void, Partial은 MvcHtmlString을 반환한다. 전자가 더 빠르지만, 큰 차이 없다. public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName, object model); public static MvcHtmlString P.. 2022. 7. 15.
ASP.NET MVC] ChildActionOnlyAttribute, ActionMethodSelectorAttribute ActionFilter action의 실행을 intercept하여, action의 실행 전 또는 후에 실행을 주입할 수 있다. ActionFilter > ChildActionOnlyAttribute ASP.NET MVC2에서 release된 action filter이다. IAuthorizationFilter interface를 구현하며, view file의 Html.Action() 또는 Html.RenderAction()에 의해서만 실행된다. Child actions은 주로 partial view와 관련되지만, 강제적이진 않다. Url request에 의해 action method가 실행되는 것을 방지하기 위한 attribute이다. 만일, Url request된다면 runtime error가 발생된다... 2022. 7. 15.
728x90
반응형