This file contains 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 Car { | |
protected String BrandName; | |
public void Go() { | |
System.out.println("I'm " + BrandName + " and I'm on my way..."); | |
} | |
} | |
public class MercedesCar extends Car { | |
public MercedesCar() { | |
BrandName = "Mercedes"; |
This file contains 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
return cats.Map<List<CatDTO>>(); |
This file contains 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
// AutoMapper will scan the assemblies passed in for Profile instances and add each to the configuration | |
Mapper.Initialize(config => | |
config.AddProfiles(new[] | |
{ | |
// Marker types for assemblies | |
// Only one type from assembly | |
typeof (BusinessMappingProfile), | |
typeof (ClassFromSomeOtherAssemblyWithMappings) | |
})); |
This file contains 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 BusinessMappingProfile : Profile | |
{ | |
public BusinessMappingProfile() | |
{ | |
CreateMap<Cat, CatDTO>() | |
.ReverseMap(); | |
CreateMap<Dog, DogDTO>() | |
.ReverseMap(); | |
} |
This file contains 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 static class ObjectExtensions | |
{ | |
public static T Map<T>(this object source) | |
{ | |
return AutoMapper.Mapper.Map<T>(source); | |
} | |
} |
This file contains 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
#!/bin/bash | |
CurrentPath=$(pwd) | |
# a directory where two repositories will get fetched to | |
SynchLocation="/C/git-synch/" | |
# bundle file location - typicly on a media that transfers the file (like USB-stick) | |
BundleLocation="/E/bundlefile.bundle" | |
# remote location and alias name for repository A | |
RemoteA="https://github.com/LocationOfRepoA.git" | |
RepoA="RepoA" | |
# remote location and alias name for repository B |
This file contains 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
// ... | |
using Microsoft.Owin.Hosting; | |
// ... | |
public class ServiceHost | |
{ | |
private IDisposable server = null; | |
const string baseAddress = "https://*:443"; | |
public void Start() |
This file contains 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
using (var excelPackage = new ExcelPackage(newFileInfo)) | |
{ | |
var ws = excelPackage.Workbook.Worksheets["Work Sheet Name"]; | |
// do the stuff, here are some examples | |
var cellRange = ws.Cells[string.Format("{0}{1}:{0}{2}", "A", 2, 4)]; | |
// merging cells | |
cellRange.Merge = true; | |
// setting value | |
cellRange.Value = "Any object that serves as cell value"; |
This file contains 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
// reading workbook from binary contents | |
var workbook = XLSX.read(excelBinaryContents, {type: 'binary'}); | |
// retrieve properties of workbook (will be needed later) | |
var wbProps = workbook.Workbook.WBProps; | |
// get any particular worksheet by name | |
var worksheet = workbook.Sheets['Work Sheet Name']; | |
// get any cell |