Skip to content

Instantly share code, notes, and snippets.

nuget.exe push -Source "MyFeedName" -ApiKey VSTS Subfolder\bin\Release\MyProject.nupkg
start nuget.exe pack Subfolder\MyProject.csproj -OutputDirectory Subfolder\bin\Release -symbols -IncludeReferencedProjects -Prop Configuration=Release
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'">
<Exec Command="$(SolutionDir)\NuGet.exe pack $(ProjectPath) -IncludeReferencedProjects -Prop Configuration=Release">
</Exec>
</Target>
<layout type="log4net.Layout.PatternLayout">
<converter>
<name value="HTTPUser" />
<type value="hbulens.Logging.HttpContextUserPatternConverter" />
</converter>
<conversionPattern value="%level %date - %message - [%property{Category}] - [%HTTPUser] %newline" />
</layout>
return myCollection.Where(x => x.MyField == 1);
public virtual IQueryable<TEntity> FindAll(Expression<Func<TEntity, bool>> where = null)
{
IQueryable<TEntity> query = where == null ? this.Context.Set <TEntity> () : this.Context.Set<TEntity>().Where(where);
var workspace = ((IObjectContextAdapter)this.Context).ObjectContext.MetadataWorkspace;
var itemCollection = (ObjectItemCollection)(workspace.GetItemCollection(DataSpace.OSpace));
var entityType = itemCollection.OfType<EntityType>().FirstOrDefault(e => itemCollection.GetClrType(e) == typeof(TEntity));
if (entityType != null)
{
var allBlogPosts = context.Blogs.Include("Posts").ToList();
public class Blog
{
public int BlogId { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string Tags { get; set; }
public ICollection<Post> Posts { get; set; }
}
public static string CharacterLimit(this string text, int length)
{
if (text.Length <= length) return text;
int pos = text.IndexOf(" ", length);
if (pos >= 0) return text.Substring(0, pos) + "...";
return text;
}
public JsonResult GetMessages()
{
using(FleetContext ctx = new FleetContext())
{
IEnumerable<string> messages = ctx.Insurers.AsQueryable().Cast<Insurer>().Select(x => x.Name).ToList();
var dataOutput = Json(messages, JsonRequestBehavior.AllowGet);
return dataOutput;
}
}