This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeViewModel : ViewModelBase | |
{ | |
public ObservableCollection<PersonViewModel> People { get; set; } | |
public RelayCommand<PersonViewModel> SayHelloCommand { get; set; } | |
public HomeViewModel() | |
{ | |
People = new ObservableCollection<PersonViewModel> | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyModule : Module | |
{ | |
protected override void Load(ContainerBuilder builder) | |
{ | |
builder.RegisterType<MemoryCacheProvider>() | |
.As<ICacheProvider>() | |
.SingleInstance(); | |
builder.RegisterType<CacheResultInterceptor>() | |
.SingleInstance(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CacheResultInterceptor : IInterceptor | |
{ | |
private readonly ICacheProvider _cache; | |
public CacheResultInterceptor(ICacheProvider cache) | |
{ | |
_cache = cache; | |
} | |
public CacheResultAttribute GetCacheResultAttribute(IInvocation invocation) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CacheResultAttribute : Attribute | |
{ | |
public int Duration { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ICacheProvider | |
{ | |
object Get(string key); | |
void Put(string key, object value, int duration); | |
bool Contains(string key); | |
} | |
public class MemoryCacheProvider : ICacheProvider |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine(worker.Process("foo")); | |
Console.WriteLine(worker.Process("foo")); | |
Console.WriteLine(worker.Process("foo")); | |
Console.WriteLine("Sleeping 2 seconds..."); | |
Thread.Sleep(2000); | |
Console.WriteLine(worker.Process("foo")); | |
// result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CacheResult(Duration = 1000)] | |
public string Process(string arg) | |
{ | |
return Guid.NewGuid().ToString("N"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FUNCTION cursor_to_csv ( | |
p_cursor IN OUT SYS_REFCURSOR | |
) | |
RETURN CLOB | |
IS | |
l_cursor_id INTEGER DEFAULT dbms_sql.open_cursor; | |
l_colval VARCHAR2 (2096); | |
l_buffer VARCHAR2 (32767) DEFAULT ''; | |
l_status INTEGER; | |
i_colcount NUMBER DEFAULT 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ITEM_ID;NAME;PRICE | |
1;mi;328 | |
2;Duis gravida praesent;5 | |
3;ac mattis semper;353 | |
4;volutpat nunc sit;431 | |
5;pede blandit;433 | |
6;eros;452 | |
7;ac orci;243 | |
8;felis ullamcorper viverra;250 | |
9;lorem, luctus ut;494 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
v_csv CLOB; | |
BEGIN | |
SELECT query_to_csv('SELECT * FROM items') INTO v_csv FROM dual; | |
END; |