2015. 10. 12. 01:11

Armed robbery in city petrol station

도시 주유소(petrol station=gas station)에서 무장한(Armed) 강도(robbery)


Three armed and masked men robbed a petrol station in Luxembourg City on Friday night, stealing the contents of the till and several cartouches of cigarettes. 

3명의 마스크 쓴 무장 남성들이 지난 금요일밤 룩셈부르크 시티의 한 주유소에서 계산 서랍(till=상점 계산대의 돈서랍)의 내용물(돈)과 담배 상자(cartouches) 여러개를 훔치는 강도질을 하였다.


The robbery took place at around 10pm at a station in rue de Rollingergrund in the capital. According to police, the three entered the petrol station and demanded the cashier empty the contents of the till into a bag. 

10시쯤 그 강도 사건은 수도의 Rollingergrund에 있는 한 주유소에서 발생했다(took place).  경찰에 의하면 그 무장강도 3명은 주유소에 들어가 계산원(cashier)에게 계산서랍(till)의 내용물(돈)을 비워서 가방에 넣으라고 요구했다(demand) 한다.


A customer who entered the shop, not realising a robbery was in progress, was held by one of the men against a fridge. The three fled towards rue JF Boch. 

그 상점에 들어와있던 고객은 강도가 진행되는 것을 눈치채지 못했고, 그 남자들 한명이 냉장고를 기대어 잡고 있었다. 그 3명은 JF Boch길 방향으로 도주하였다(fled, flee의 과거형).


후기

ㅎㄷㄷ 아니 룩셈부르크가 총 들고 설칠 수 있는 나라인 줄 몰랐네. Armed라는 의미가 칼도 해당되는지 모르겠다.

Posted by CoolDragon
2015. 10. 10. 01:33
시작하면서..
룩셈부르크에 살면서 너무 소식이 둔한 것 같기에 영문번역을 통하여 새소식도 듣고 영어공부도 도모하고자 번역을 해본다.

룩스에어는 북유럽의 여러 목적지로 비행을 확대한다.


There will be even more options for people travelling between Prague and Luxembourg when Luxair begins flying the route from March, 2016. 

룩스에어가 2016년 3월부터 프라하-룩셈부르크간 비행을 취항할 때 사람들이 여행할 수 있는 선택권이 늘어날 것이다.


According to the airline, it will fly returns four times a week from March 27, on Mondays, Wednesdays, Fridays and Sundays. 

룩스에어에 의하면(according to), 3월 27일부터 매주 월요일, 수요일, 금요일, 토요일 일주일에 4번 취항할 것이라고 했다.


Fares are expected to start at around 149 euros. Luxair says it will add flights to Stockholm and Copenhagen.

요금은 149유로 쯤으로 시작할 것으로 예상된다. 룩스에어는 스톡홀름과 코펜하겐도 비행을 추가할 것이라고 말한다.


A Saturday flight to Stockholm will be offered from summer 2016, while a Saturday flight to Copenhagen will start in November 2016. 

스톡홀름으로 가는 토요일 비행은 2016년 여름에 제공될(be offered)것 이며, 코펜하겐으로 가는 토요일 비행기는 2016년 11월에 시작될 것이다.


Luxair says will also increase its offer to Dublin during the winter season, with six weekly flights.

룩스에어는 겨울동안 더블린으로 가는 비행기편 또한 주(wieekly) 6회 비행으로 증설할 것이라고 말한다.


후기

기사 번역을 시도해 보지만 매끄럽지 않게 번역이 되어 버렸다. 영어를 모르는건지 국어를 모르는건지.. 틀린부분이 있으면 댓글로 좀 부탁드려요.

Posted by CoolDragon
2015. 9. 18. 19:54

잡설

나는 Entity Framework는 그저 Link to SQL의 확장 정도로 인식해 왔다. 하지만 많은 유튜브 동영상 강좌를 보니 생각보다 다양한 하고 복잡한 프로그래밍 방식을 제공하는 것 같았다. 본인 프로그래밍 방식은 RDBMS에 프로시저 등을 생성하고 코드단에서 그 프로시저들을 호출하는 형태로 작업을 많이 해왔다. 그래서 최소한의 필요 데이터 만을 가져오는 것을 지향해서 테이블 단위의 Model을 생성하기 보다는 그때 그때 필요에 의해 모델들을 생성하다 보니 중복되는 code들이 늘어나는 것을 느꼈다. 특히 Relation에 엮여있는 테이블들의 데이터는 어떤 액션을 하느냐에 따라서 더 그런거 같더라.. 포스팅을 하는 지금 다시 생각해 보면 내가 한 코드단 모델링 방식은 잘 못 설계한 것이라는 생각이 든다. 잡설은 여기까지 하고 Entity Framework에 대한 사용법을 정리해보고자 한다.


Pre-Requisite

Entity Framework Power Tools 설치 (선택된 데이터베이스의 스키마를 자동으로 c#코드로 제너레이션 해준다.)

 - https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d (VS2015 지원안함)

 - https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838


Development Method

 - Database first: 데이터베이스에 접속하여 스키마를 통하여 모델과 엔티티를 자동생성

 - Model First: 비쥬얼 스튜디오에서 모델을 직접 설계하고 관계도를 만들면 엔티티가 자동생성 (ERD와 비슷)

 - Code First: 자동 생성 없이 엔티티와 DBContext를 상속받은 클래스를 개발자가 직접 작성


Package Manager Console

# entity framework 설치 (Nuget을 사용할 수 있다.)

PM> install-package entityframework


# 데이터베이스의 스키마 정보가 c# 코드로 생성(자동 제너레이션)

PM> enable-migrations


# 데이터베이스의 스키마와 c#코드상에 스키마 정보를 비교하여 변경된 스키마 정보를 yyyyMMddHHmmss_FileName이라는 c#파일로 생성

PM> add-migration FileName


# 아래 명령어를 통하여 변경된 스키마를 데이터베이스에 적용

PM> Update-Database


# 데이터베이스에 적용된 스키마 롤백 (선택된 파일의 상태때로 되돌아 간다. 즉, 선택 파일 이후에 변경되었던 스키마 정보는 모두 롤백된다.)

PM> Update-Database -targetmigration 마이그레이션파일명(.cs제외)


# 최초의 스키마 정보에서부터 타켓으로 변경된 스키마 정보(yyyyMMddHHmmss_FileName)가 스크립트로 생성

PM> Update-Database -Script -SourceMigration: @InitialDatabase - TargetMigration: yyyyMMddHHmmss_FileName


DbContext

public class Employee

{

  public string Id {get; set;}

  public string Name {get; set;}

}


public class EmployeeDBContext : DbContext

{

  public DbSet<Employee> Employees {get; set;}


  protected override void OnModelCreating(DbModelBuilder modelBuilder)

  {

    // 여기에 Entity의 컬럼 속성 및 테이블/프로시져 맵핑 등을 설정할 수 있다.

    // 테이블명이 복수형으로 만들어지는 것을 방지

    modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

    // Employee에 DB에 프로시져 자동 생성 및 맵핑

    modelBuilder.Entity<Employee>().MapToStoredProcedures

    (p => p.Insert(i => i.HasName("insertEmployee"))

               .Update(i => i.HasName("UpdateEmployee"))

               .Delete(i => i.HasName("DeleteEmployee")));

    base.OnModelCreating(modelBuilder)

  }

}


Pattern

 - Repositories Pattern

 - Unit of Work


DB Initializer

// DB 초기화 클래스 생성

public class DBInitializer : DropCreateDatabaseIfModelChanges<EmployeeDBContext>

{

  protected override void Seed(EmployeeDBContext context)

  {

    // 여기에 Context에 DataSet<Entity>로 선언된 프로퍼티의 기준 데이터를 생성해 줄 수 있다.

    base.Seed(context); 

  }

}

// Main() 함수나 Global.asax 의 실행부에 아래 함수를 호출하거나

System.Data.Entity.Database.SetInitializer(new DBInitializer());

// 또는 app.config나 web.config의 <entityframwork>에서 설정이 가능하다.

  <entityFramework>

    <contexts>

      <context type="Context Class Name, DLL Name">

        <databaseInitializer type="DBInitializer, DLL Name" />

      </context>

    </contexts>



Attribute

[SoftDelete("Property Name")]

모델 클래스에 SoftDelete()라는 속성을 선언하면 DB에 쿼리를 만드는 시점 Command Tree Interceptor 에서 그 쿼리를 가로채 실제 요청쿼리에 맞게 변환작업을 할 수 있게 한다.

이 기능이 구현하기 위해서는 Custom Attribute class 와 IDbCommandTreeInterceptor 인터페이스를 상속받은 class를 만들어 주어야 한다.


[DisplayFormat(DataFormatString = "{0:C0}")]



Tutorial

http://www.entityframeworktutorial.net/code-first/entity-framework-code-first.aspx


참조

https://www.youtube.com/playlist?list=PL6n9fhu94yhUPBSX-E2aJCnCR3-_6zBZx

https://www.youtube.com/watch?v=iwEG1M2ONrw

https://www.youtube.com/watch?v=vspEYmp6zWc

https://www.youtube.com/watch?v=i9Il79a2uBU

Posted by CoolDragon