parent
a84b410cea
commit
e55b1667f4
|
@ -9,6 +9,13 @@ namespace BuildFeed
|
|||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
routes.MapHttpRoute("API", "api/{action}/{id}",
|
||||
new
|
||||
{
|
||||
controller = "api",
|
||||
action = "GetBuilds",
|
||||
id = UrlParameter.Optional
|
||||
});
|
||||
routes.AppendTrailingSlash = true;
|
||||
routes.MapMvcAttributeRoutes();
|
||||
}
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
@model BuildFeed.Models.MetaItem
|
||||
|
||||
@model BuildFeed.Models.MetaItemModel
|
||||
@{
|
||||
ViewBag.Title = $"Add metadata for {Model.Id.Value} | BuildFeed";
|
||||
ViewBag.Title = string.Format("Add metadata for {0} | BuildFeed", Model.Id.Value);
|
||||
}
|
||||
|
||||
<h2>@($"Add metadata for {Model.Id.Value}")</h2>
|
||||
<h2>@string.Format("Add metadata for {0}", Model.Id.Value)</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
@Html.HiddenFor(model => model.Id.Type)
|
||||
@Html.HiddenFor(model => model.Id.Value)
|
||||
@Html.HiddenFor(model => model.Id.Type)
|
||||
@Html.HiddenFor(model => model.Id.Value)
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.MetaDescription, htmlAttributes: new { @class = "control-label col-sm-2" })
|
||||
<div class="col-sm-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
@Html.TextAreaFor(model => model.MetaDescription, new { @class = "form-control", rows = "2" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.MetaDescription)
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.MetaDescription, htmlAttributes: new { @class = "control-label col-sm-2" })
|
||||
<div class="col-sm-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
@Html.TextAreaFor(model => model.MetaDescription, new { @class = "form-control", rows = "2" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.MetaDescription)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.PageContent, new { @class = "control-label col-sm-2" })
|
||||
<div class="col-sm-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
@Html.TextAreaFor(model => model.PageContent, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.PageContent)
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.PageContent, new { @class = "control-label col-sm-2" })
|
||||
<div class="col-sm-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
@Html.TextAreaFor(model => model.PageContent, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.PageContent)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="submit" value="Add metadata" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="submit" value="Add metadata" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script src="~/Scripts/trumbowyg/trumbowyg.min.js" type="text/javascript"></script>
|
||||
<link href="~/Scripts/trumbowyg/ui/trumbowyg.min.css" rel="stylesheet" type="text/css" />
|
||||
<script src="~/Scripts/trumbowyg/trumbowyg.min.js" type="text/javascript"></script>
|
||||
<link href="~/Scripts/trumbowyg/ui/trumbowyg.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var btnsGrps = $.trumbowyg.btnsGrps;
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var btnsGrps = $.trumbowyg.btnsGrps;
|
||||
|
||||
$("#@Html.IdFor(model => model.PageContent)").trumbowyg({
|
||||
semantic: true,
|
||||
autogrow: true,
|
||||
btns: ['viewHTML',
|
||||
'|', 'strong', 'em',
|
||||
'|', 'link',
|
||||
'|', btnsGrps.justify,
|
||||
'|', btnsGrps.lists]
|
||||
});
|
||||
})
|
||||
</script>
|
||||
$("#@Html.IdFor(model => model.PageContent)").trumbowyg({
|
||||
semantic: true,
|
||||
autogrow: true,
|
||||
btns: ['viewHTML',
|
||||
'|', 'strong', 'em',
|
||||
'|', 'link',
|
||||
'|', btnsGrps.justify,
|
||||
'|', btnsGrps.lists]
|
||||
});
|
||||
})
|
||||
</script>
|
||||
}
|
|
@ -19,7 +19,6 @@ namespace BuildFeed.Controllers
|
|||
bModel = new Build();
|
||||
}
|
||||
|
||||
[Route("/api/GetWin10Labs/")]
|
||||
public async Task<IEnumerable<string>> GetWin10Labs()
|
||||
{
|
||||
List<string> labs = new List<string>();
|
||||
|
@ -34,7 +33,6 @@ namespace BuildFeed.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("/api/AddWin10Builds/")]
|
||||
public async Task<bool> AddWin10Builds(NewBuild apiModel)
|
||||
{
|
||||
if (apiModel == null)
|
||||
|
@ -61,10 +59,9 @@ namespace BuildFeed.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
[Route("/api/GetSearchResult/{query}/")]
|
||||
public async Task<IEnumerable<SearchResult>> GetSearchResult(string query)
|
||||
public async Task<IEnumerable<SearchResult>> GetSearchResult(string id)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
return new SearchResult[0];
|
||||
}
|
||||
|
@ -72,12 +69,12 @@ namespace BuildFeed.Controllers
|
|||
List<SearchResult> results = new List<SearchResult>();
|
||||
|
||||
var sourceResults = from s in Enum.GetValues(typeof(TypeOfSource)).Cast<TypeOfSource>().Select(s => new { Text = DisplayHelpers.GetDisplayTextForEnum(s), Value = s })
|
||||
where s.Text.ToLower().Contains(query.ToLower())
|
||||
orderby s.Text.ToLower().IndexOf(query.ToLower(), StringComparison.Ordinal) ascending
|
||||
where s.Text.ToLower().Contains(id.ToLower())
|
||||
orderby s.Text.ToLower().IndexOf(id.ToLower(), StringComparison.Ordinal) ascending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Source Root", new { controller = "front", action = "viewSource", source = s.Value }),
|
||||
Label = s.Text.Replace(query, "<strong>" + query + "</strong>"),
|
||||
Label = s.Text.Replace(id, "<strong>" + id + "</strong>"),
|
||||
Title = s.Text,
|
||||
Group = Common.SearchSource
|
||||
};
|
||||
|
@ -86,12 +83,12 @@ namespace BuildFeed.Controllers
|
|||
|
||||
|
||||
var versionResults = from v in await bModel.SelectBuildVersions()
|
||||
where $"{v.Major}.{v.Minor}".StartsWith(query)
|
||||
where $"{v.Major}.{v.Minor}".StartsWith(id)
|
||||
orderby v.Major descending, v.Minor descending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Version Root", new { controller = "front", action = "viewVersion", major = v.Major, minor = v.Minor }),
|
||||
Label = $"{v.Major}.{v.Minor}".Replace(query, "<strong>" + query + "</strong>"),
|
||||
Label = $"{v.Major}.{v.Minor}".Replace(id, "<strong>" + id + "</strong>"),
|
||||
Title = "",
|
||||
Group = Common.SearchVersion
|
||||
};
|
||||
|
@ -100,12 +97,12 @@ namespace BuildFeed.Controllers
|
|||
|
||||
|
||||
var yearResults = from y in await bModel.SelectBuildYears()
|
||||
where y.ToString().Contains(query)
|
||||
where y.ToString().Contains(id)
|
||||
orderby y descending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Year Root", new { controller = "front", action = "viewYear", year = y }),
|
||||
Label = y.ToString().Replace(query, "<strong>" + query + "</strong>"),
|
||||
Label = y.ToString().Replace(id, "<strong>" + id + "</strong>"),
|
||||
Title = "",
|
||||
Group = Common.SearchYear
|
||||
};
|
||||
|
@ -113,13 +110,13 @@ namespace BuildFeed.Controllers
|
|||
results.AddRange(yearResults);
|
||||
|
||||
|
||||
var labResults = from l in await bModel.SearchBuildLabs(query)
|
||||
orderby l.IndexOf(query.ToLower()) ascending,
|
||||
var labResults = from l in await bModel.SearchBuildLabs(id)
|
||||
orderby l.IndexOf(id.ToLower()) ascending,
|
||||
l.Length ascending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Lab Root", new { controller = "front", action = "viewLab", lab = l.Replace('/', '-') }),
|
||||
Label = l.Replace(query, $"<strong>{query}</strong>"),
|
||||
Label = l.Replace(id, $"<strong>{id}</strong>"),
|
||||
Title = l,
|
||||
Group = Common.SearchLab
|
||||
};
|
||||
|
@ -128,13 +125,13 @@ namespace BuildFeed.Controllers
|
|||
|
||||
|
||||
var buildResults = from b in await bModel.Select()
|
||||
where b.FullBuildString.ToLower().Contains(query.ToLower())
|
||||
orderby b.FullBuildString.ToLower().IndexOf(query.ToLower(), StringComparison.Ordinal) ascending,
|
||||
where b.FullBuildString.ToLower().Contains(id.ToLower())
|
||||
orderby b.FullBuildString.ToLower().IndexOf(id.ToLower(), StringComparison.Ordinal) ascending,
|
||||
b.BuildTime descending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Build", new { controller = "front", action = "viewBuild", id = b.Id }),
|
||||
Label = b.FullBuildString.Replace(query, $"<strong>{query}</strong>"),
|
||||
Label = b.FullBuildString.Replace(id, $"<strong>{id}</strong>"),
|
||||
Title = b.FullBuildString,
|
||||
Group = Common.SearchBuild
|
||||
};
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
<value>Draag bij via</value>
|
||||
</data>
|
||||
<data name="Credits" xml:space="preserve">
|
||||
<value>Dankwoord </value>
|
||||
<value>Dankwoord</value>
|
||||
</data>
|
||||
<data name="DevelopedBy" xml:space="preserve">
|
||||
<value>Ontwikkeld door</value>
|
||||
|
|
|
@ -2,5 +2,19 @@
|
|||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<system.web>
|
||||
<httpModules>
|
||||
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" xdt:Transform="Insert" />
|
||||
</httpModules>
|
||||
<httpHandlers>
|
||||
<add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" xdt:Transform="Insert" />
|
||||
</httpHandlers>
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" xdt:Transform="Insert" />
|
||||
</handlers>
|
||||
<modules>
|
||||
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" xdt:Transform="Insert" />
|
||||
</modules>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<system.web>
|
||||
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||
<trace enabled="false" requestLimit="40" pageOutput="false" xdt:Transform="Replace" />
|
||||
<httpModules>
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" xdt:Transform="Insert" />
|
||||
</httpModules>
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<modules>
|
||||
<remove name="ApplicationInsightsWebTracking" xdt:Transform="Insert" />
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" xdt:Transform="Insert" />
|
||||
</modules>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="CanonicalHost" stopProcessing="true" xdt:Transform="Insert">
|
||||
<match url="(.*)" />
|
||||
<conditions logicalGrouping="MatchAny">
|
||||
<add input="{HTTP_HOST}" pattern="^buildfeed\.net$" negate="true" />
|
||||
<add input="{HTTPS}" pattern="off" />
|
||||
</conditions>
|
||||
<action type="Redirect" url="https://buildfeed.net/{R:1}" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
<system.web>
|
||||
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||
<trace enabled="false" requestLimit="40" pageOutput="false" xdt:Transform="Replace" />
|
||||
<httpModules>
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" xdt:Transform="Insert" />
|
||||
</httpModules>
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<modules>
|
||||
<remove name="ApplicationInsightsWebTracking" xdt:Transform="Insert" />
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" xdt:Transform="Insert" />
|
||||
</modules>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="CanonicalHost" stopProcessing="true" xdt:Transform="Insert">
|
||||
<match url="(.*)" />
|
||||
<conditions logicalGrouping="MatchAny">
|
||||
<add input="{HTTP_HOST}" pattern="^buildfeed\.net$" negate="true" />
|
||||
<add input="{HTTPS}" pattern="off" />
|
||||
</conditions>
|
||||
<action type="Redirect" url="https://buildfeed.net/{R:1}" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
|
|
|
@ -35,21 +35,21 @@
|
|||
</providers>
|
||||
</roleManager>
|
||||
<httpModules>
|
||||
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" />
|
||||
</httpModules>
|
||||
<httpHandlers>
|
||||
<add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" />
|
||||
</httpHandlers>
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<urlCompression doDynamicCompression="true" />
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
<handlers>
|
||||
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
|
||||
<remove name="OPTIONSVerbHandler" />
|
||||
<remove name="TRACEVerbHandler" />
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||
<add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" />
|
||||
</handlers>
|
||||
<modules>
|
||||
</modules>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="(2015-05) Support Pages">
|
||||
|
@ -83,10 +83,6 @@
|
|||
</rewriteMap>
|
||||
</rewriteMaps>
|
||||
</rewrite>
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
<modules>
|
||||
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
|
||||
</modules>
|
||||
</system.webServer>
|
||||
<system.net>
|
||||
<mailSettings>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RedisMongoMigration
|
||||
{
|
||||
public class MetaItemKey
|
||||
{
|
||||
public string Value { get; set; }
|
||||
public MetaType Type { get; set; }
|
||||
|
||||
public MetaItemKey()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MetaItemKey(string id)
|
||||
{
|
||||
var items = id.Split(':');
|
||||
Type = (MetaType)Enum.Parse(typeof(MetaType), items[0]);
|
||||
Value = items[1];
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Type}:{Value}";
|
||||
}
|
||||
}
|
||||
|
||||
public enum MetaType
|
||||
{
|
||||
Lab,
|
||||
Version,
|
||||
Source,
|
||||
Year
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RedisMongoMigration.Mongo
|
||||
{
|
||||
public class MetaItemModel
|
||||
{
|
||||
[BsonId]
|
||||
public MetaItemKey Id { get; set; }
|
||||
|
||||
public string PageContent { get; set; }
|
||||
|
||||
public string MetaDescription { get; set; }
|
||||
}
|
||||
|
||||
public class MetaItem
|
||||
{
|
||||
private const string _buildCollectionName = "metaitem";
|
||||
|
||||
private MongoClient _dbClient;
|
||||
private IMongoCollection<MetaItemModel> _buildCollection;
|
||||
|
||||
public MetaItem()
|
||||
{
|
||||
_dbClient = new MongoClient(new MongoClientSettings()
|
||||
{
|
||||
Server = new MongoServerAddress("localhost", 27017)
|
||||
});
|
||||
|
||||
_buildCollection = _dbClient.GetDatabase("BuildFeed").GetCollection<MetaItemModel>(_buildCollectionName);
|
||||
}
|
||||
|
||||
public List<MetaItemModel> Select()
|
||||
{
|
||||
var task = _buildCollection.Find(new BsonDocument()).ToListAsync();
|
||||
task.Wait();
|
||||
return task.Result;
|
||||
}
|
||||
|
||||
public void Insert(MetaItemModel item)
|
||||
{
|
||||
var task = _buildCollection.InsertOneAsync(item);
|
||||
task.Wait();
|
||||
}
|
||||
|
||||
public void InsertAll(IEnumerable<MetaItemModel> items)
|
||||
{
|
||||
var task = _buildCollection.InsertManyAsync(items);
|
||||
task.Wait();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,9 @@ using System.Threading.Tasks;
|
|||
using MBuildModel = RedisMongoMigration.Mongo.BuildModel;
|
||||
using MBuild = RedisMongoMigration.Mongo.Build;
|
||||
using RBuild = RedisMongoMigration.Redis.Build;
|
||||
using MMetaItemModel = RedisMongoMigration.Mongo.MetaItemModel;
|
||||
using MMetaItem = RedisMongoMigration.Mongo.MetaItem;
|
||||
using RMetaItem = RedisMongoMigration.Redis.MetaItem;
|
||||
using MongoLevelOfFlight = RedisMongoMigration.Mongo.MongoLevelOfFlight;
|
||||
using RedisLevelOfFlight = RedisMongoMigration.Redis.RedisLevelOfFlight;
|
||||
using MMemberModel = RedisMongoMigration.Mongo.MemberModel;
|
||||
|
@ -48,6 +51,21 @@ namespace RedisMongoMigration
|
|||
mb.InsertAll(builds);
|
||||
Console.WriteLine("Builds: Complete");
|
||||
|
||||
var metas = from b in RMetaItem.Select()
|
||||
select new MMetaItemModel()
|
||||
{
|
||||
Id = new MetaItemKey()
|
||||
{
|
||||
Type = b.Id.Type,
|
||||
Value = b.Id.Value
|
||||
},
|
||||
MetaDescription = b.MetaDescription,
|
||||
PageContent = b.PageContent
|
||||
};
|
||||
MMetaItem mmi = new MMetaItem();
|
||||
mmi.InsertAll(metas);
|
||||
Console.WriteLine("Meta Item: Complete");
|
||||
|
||||
var members = from r in RMember.Select()
|
||||
select new MMemberModel()
|
||||
{
|
||||
|
|
|
@ -1,46 +1,50 @@
|
|||
using NServiceKit.DataAnnotations;
|
||||
using NServiceKit.DesignPatterns.Model;
|
||||
using NServiceKit.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace RedisMongoMigration.Redis
|
||||
{
|
||||
[DataObject]
|
||||
public class MetaItem : IHasId<MetaItemKey>
|
||||
{
|
||||
[Key]
|
||||
[Index]
|
||||
public MetaItemKey Id { get; set; }
|
||||
[DataObject]
|
||||
public class MetaItem : IHasId<MetaItemKey>
|
||||
{
|
||||
[Key]
|
||||
[Index]
|
||||
public MetaItemKey Id { get; set; }
|
||||
|
||||
public string PageContent { get; set; }
|
||||
public string PageContent { get; set; }
|
||||
|
||||
public string MetaDescription { get; set; }
|
||||
}
|
||||
public string MetaDescription { get; set; }
|
||||
|
||||
public struct MetaItemKey
|
||||
{
|
||||
public string Value { get; set; }
|
||||
public MetaType Type { get; set; }
|
||||
|
||||
public MetaItemKey(string id)
|
||||
{
|
||||
var items = id.Split(':');
|
||||
Type = (MetaType)Enum.Parse(typeof(MetaType), items[0]);
|
||||
Value = items[1];
|
||||
}
|
||||
public static IEnumerable<MetaItem> Select()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient("localhost", 6379, db: 1))
|
||||
{
|
||||
var client = rClient.As<MetaItem>();
|
||||
return client.GetAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Type}:{Value}";
|
||||
}
|
||||
}
|
||||
public struct MetaItemKey
|
||||
{
|
||||
public string Value { get; set; }
|
||||
public MetaType Type { get; set; }
|
||||
|
||||
public enum MetaType
|
||||
{
|
||||
Lab,
|
||||
Version,
|
||||
Source,
|
||||
Year
|
||||
}
|
||||
public MetaItemKey(string id)
|
||||
{
|
||||
var items = id.Split(':');
|
||||
Type = (MetaType)Enum.Parse(typeof(MetaType), items[0]);
|
||||
Value = items[1];
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Type}:{Value}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,16 +45,16 @@
|
|||
<HintPath>..\packages\MongoDB.Driver.Core.2.0.1\lib\net45\MongoDB.Driver.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Common, Version=1.0.40.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.40\lib\net35\NServiceKit.Common.dll</HintPath>
|
||||
<Reference Include="NServiceKit.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Common.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Interfaces, Version=1.0.40.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.40\lib\net35\NServiceKit.Interfaces.dll</HintPath>
|
||||
<Reference Include="NServiceKit.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Interfaces.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Redis, Version=1.0.17.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NServiceKit.Redis.1.0.17\lib\net35\NServiceKit.Redis.dll</HintPath>
|
||||
<Reference Include="NServiceKit.Redis, Version=1.0.10.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NServiceKit.Redis.1.0.10\lib\net35\NServiceKit.Redis.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Text, Version=1.0.10.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
|
@ -73,7 +73,9 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Build.cs" />
|
||||
<Compile Include="MetaItem.cs" />
|
||||
<Compile Include="Mongo\Build.cs" />
|
||||
<Compile Include="Mongo\MetaItem.cs" />
|
||||
<Compile Include="Mongo\MongoMember.cs" />
|
||||
<Compile Include="Mongo\MongoRole.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<package id="MongoDB.Bson" version="2.0.1" targetFramework="net46" />
|
||||
<package id="MongoDB.Driver" version="2.0.1" targetFramework="net46" />
|
||||
<package id="MongoDB.Driver.Core" version="2.0.1" targetFramework="net46" />
|
||||
<package id="NServiceKit.Common" version="1.0.40" targetFramework="net46" />
|
||||
<package id="NServiceKit.Redis" version="1.0.17" targetFramework="net46" />
|
||||
<package id="NServiceKit.Common" version="1.0.27" targetFramework="net46" />
|
||||
<package id="NServiceKit.Redis" version="1.0.10" targetFramework="net46" />
|
||||
<package id="NServiceKit.Text" version="1.0.10" targetFramework="net46" />
|
||||
</packages>
|
Loading…
Reference in New Issue