Last active
December 21, 2015 07:19
-
-
Save smsohan/6270255 to your computer and use it in GitHub Desktop.
LinkedResource using a Stream instead of a file path on disc
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 StreamResourceProvider : LinkedResourceProvider{ | |
/// <summary> | |
/// Gets a linked resource given its Id and FilePath | |
/// </summary> | |
public override LinkedResource Get(string contentId, string filePath){ | |
var stream = GetYourStream(contentId, filePath); | |
return new LinkedResource(stream); | |
} | |
private Stream GetYourStream(contentId, filePath){ | |
//initialize the stream based on your custom logic | |
} | |
} | |
public class YourMailer : MailerBase{ | |
public YourMailer(){ | |
//Use the StreamResourceProvider for your mailer | |
this.LinkedResourceProvider = new StreamResourceProvider(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment