Paweł Iżycki

.NET developer, fan of automation and backend world.

DevoWeek - 2017/11/26

26 Nov 2017 » Category: DevoWeek » Tags: SQL, LINQ, C#, Angular

This week:

  • Why calling ‘man’ at 0:30 throws with error ‘gimmie gimmie gimmie’? - Funny easter egg found in some testing library.
  • Select all MSSQL objects touched in last N days - Short script taken from MSDN. I had an issue while creating new database table. When running a script, I was getting an error There is already an object named 'TABLE_NAME' in the database.. Apex SQL Search failed finding anything with that name, but this script saved my sanity.

    SELECT name AS object_name   
      ,SCHEMA_NAME(schema_id) AS schema_name  
      ,type_desc  
      ,create_date  
      ,modify_date  
    FROM sys.objects  
    WHERE modify_date > GETDATE() - 1  -- N := 1
    ORDER BY modify_date;  
    GO  
    
  • LINQ query examples - Recently I’ve changed my job and now I have to deal with EF Core and massive LINQ queries. Because of database design, there is a lot of joins, which look awful in fluent LINQ queries, but not in traditional way. I gotta admit that I prefer writing queries in fluent way, but left with no choice, but to adapt, I had to remind myself a bit about tradinal approach to LINQ. Those samples were the great way and I think will be a great look up source.

  • Range in C# 7.3 - Cool feature. We can do similiar thing with Enumerable.Range() right now, but surely it was missing.

  • Showing an alternative template using else - I was kindly suprised that such feature exists in “new” Angular. In case you want to display different HTML content on your page, you can use this syntax.

    Here is my use case, the simple pager component

    <div>
      <span *ngFor="let p of pages"><span *ngIf="!!pagination && p===pagination.page; else elseBlock">[ <a (click)="selectPage(p)"></a> ]</span><ng-template #elseBlock>[  ]</ng-template></span>
    </div>
    

And here is my first post of the DevoWeek series. First thing I have to do is to automate creating new branches for each week post. But that has to wait a bit.

See you the next weekend!

Related Posts