Initial import

This commit is contained in:
Paul Schneider
2014-07-16 20:35:03 +02:00
parent 0c865416ca
commit 04804b89a9
279 changed files with 12945 additions and 0 deletions

View File

@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("NpgsqlBlogProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("paul")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@ -0,0 +1,35 @@
using System;
using System.Configuration;
using System.Reflection;
using System.Collections.Specialized;
using Npgsql.Web.Blog.Configuration;
namespace Npgsql.Web.Blog
{
public static class BlogHelper
{
public static BlogProvider GetProvider ()
{
BlogProvidersConfigurationSection config = ConfigurationManager.GetSection ("system.web/blog") as BlogProvidersConfigurationSection;
if (config == null)
throw new ConfigurationErrorsException("The configuration bloc for the blog provider was not found");
BlogProviderConfigurationElement celt =
config.Providers.GetElement (config.DefaultProvider);
if (config == null)
throw new ConfigurationErrorsException("The default blog provider was not found");
ConstructorInfo ci = Type.GetType (celt.Type).GetConstructor (Type.EmptyTypes);
BlogProvider bp = ci.Invoke (Type.EmptyTypes) as BlogProvider;
NameValueCollection c = new NameValueCollection ();
c.Add ("name", celt.Name);
c.Add ("type", celt.Type);
c.Add ("connectionStringName", celt.ConnectionStringName);
c.Add ("description", celt.Description);
c.Add ("applicationName", celt.ApplicationName);
bp.Initialize (celt.Name, c);
return bp;
}
}
}

View File

@ -0,0 +1,61 @@
using System;
using Npgsql.Web.Blog.DataModel;
namespace Npgsql.Web.Blog
{
public static class BlogManager
{
public static long RemoveComment(long cmtid)
{
return Provider.RemoveComment (cmtid);
}
public static void Comment (string from, long postid, string content, bool visible)
{
provider.Comment (from, postid, content);
}
static BlogProvider provider;
public static BlogProvider Provider {
get {
if (provider == null)
provider = BlogHelper.GetProvider();
return provider;
}
}
public static BlogEntry GetPost (string username, string title)
{
return Provider.GetPost (username, title );
}
public static BlogEntry GetPost(long postid)
{
return Provider.GetPost (postid);
}
public static void Post(string username, string title, string content, bool visible)
{
Provider.Post(username, title, content, visible );
}
public static void UpdatePost(long postid, string content, bool visible)
{
Provider.UpdatePost(postid, content, visible);
}
public static BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
{
return Provider.FindPost (pattern, searchflags, pageIndex, pageSize, out totalRecords);
}
public static void RemovePost (string username, string title)
{
Provider.RemovePost (username, title);
}
public static BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)
{
return Provider.LastPosts (pageIndex, pageSize, out totalRecords);
}
public static Comment[] GetComments(long postid, bool getHidden=true)
{
return Provider.GetComments (postid,getHidden);
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Configuration;
using System.Configuration.Provider;
using System.Collections.Generic;
using Npgsql.Web.Blog.DataModel;
namespace Npgsql.Web.Blog
{
public abstract class BlogProvider: ProviderBase
{
public abstract BlogEntry GetPost (long postid);
public abstract BlogEntry GetPost (string username, string title);
public abstract long GetPostId (string username, string title);
public abstract long Post (string username, string title, string content, bool visible);
public abstract void UpdatePost (long postid, string content, bool visible);
public abstract BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags,
int pageIndex, int pageSize, out int totalRecords);
public abstract void RemovePost (string username, string title);
public abstract void RemovePost (long postid);
public abstract long RemoveComment (long cmtid);
public abstract BlogEntryCollection LastPosts(int pageIndex, int pageSize, out int totalRecords);
public abstract string BlogTitle (string username);
public abstract long Comment (string from, long postid, string content);
public abstract Comment[] GetComments (long postid, bool getHidden) ;
public abstract bool AutoValidateComment { get; set; }
public abstract void ValidateComment (long cmtid);
public abstract void UpdateComment (long cmtid, string content, bool visible);
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Configuration;
using System.ComponentModel;
namespace Npgsql.Web.Blog.Configuration
{
public class BlogProviderConfigurationElement : ConfigurationElement
{
[ConfigurationProperty("name", IsRequired = true, IsKey=true)]
public string Name {
get { return (string)this ["name"]; }
set { this ["name"] = value; }
}
[ConfigurationProperty("type", IsRequired = true, IsKey=false)]
public string Type {
get { return (string)this ["type"]; }
set { this ["type"] = value; }
}
[ConfigurationProperty("connectionStringName")]
public string ConnectionStringName {
get { return (string)this ["connectionStringName"]; }
set { this ["connectionStringName"] = value; }
}
[ConfigurationProperty("description")]
public string Description {
get { return (string)this ["description"]; }
set { this ["description"] = value; }
}
[ConfigurationProperty("applicationName")]
public string ApplicationName {
get { return (string)this ["applicationName"]; }
set { this ["applicationName"] = value; }
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Configuration;
using System.ComponentModel;
namespace Npgsql.Web.Blog.Configuration
{
public class BlogProvidersConfigurationCollection : ConfigurationElementCollection
{
protected override ConfigurationElement CreateNewElement ()
{
return new BlogProviderConfigurationElement();
}
protected override object GetElementKey (ConfigurationElement element)
{
return ((BlogProviderConfigurationElement) element).Name;
}
public BlogProviderConfigurationElement GetElement (string name)
{
return this.BaseGet(name) as BlogProviderConfigurationElement;
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Configuration;
using System.ComponentModel;
namespace Npgsql.Web.Blog.Configuration
{
public class BlogProvidersConfigurationSection : ConfigurationSection
{
[ConfigurationProperty("defaultProvider")]
public string DefaultProvider {
get { return (string)base ["defaultProvider"]; }
set { base ["defaultProvider"] = value; }
}
[ConfigurationProperty("providers")]
[ConfigurationCollection(typeof(BlogProvidersConfigurationCollection),
AddItemName = "add",
ClearItemsName = "clear",
RemoveItemName = "remove")]
public BlogProvidersConfigurationCollection Providers{
get { return (BlogProvidersConfigurationCollection) base ["providers"]; }
set { base ["providers"] = value; }
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Configuration;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace Npgsql.Web.Blog.DataModel
{
public class Blog
{
string title;
[StringValidator(MaxLength=512)]
[Required]
[DisplayName("Titre")]
public string Title {
get {
return title;
}
set {
title = value;
}
}
}
}

View File

@ -0,0 +1,91 @@
using System;
using System.Configuration;
using System.Configuration.Provider;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Npgsql.Web.Blog.DataModel
{
public class BlogEntry
{
long id;
[DisplayName("Identifiant numérique de billet")]
public long Id {
get {
return id;
}
set {
id = value;
}
}
string title;
[StringValidator(MaxLength=512)]
[DisplayName("Titre du billet")]
[StringLength(512)]
[RegularExpression("^[^:%&?]*$",ErrorMessage = "Les caratères suivants sont invalides pour un titre: :%&?")]
[Required(ErrorMessage = "S'il vous plait, saisissez un titre")]
public string Title {
get {
return title;
}
set {
title = value;
}
}
string content;
[DisplayName("Corps du billet")]
[Required(ErrorMessage = "S'il vous plait, saisissez un texte.")]
public string Content {
get {
return content;
}
set {
content = value;
}
}
string userName;
[StringValidator(MaxLength=255)]
[DisplayName("Nom de l'auteur")]
public string UserName {
get {
return userName;
}
set {
userName = value;
}
}
public DateTime posted;
[DisplayName("Date de creation")]
public DateTime Posted {
get {
return posted;
}
set {
posted = value;
}
}
public DateTime modified;
[DisplayName("Date de modification")]
public DateTime Modified {
get {
return modified;
}
set {
modified = value;
}
}
public bool Visible { get; set ; }
public string [] Tags { get; set ; }
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Configuration;
using System.Configuration.Provider;
using System.Collections.Generic;
namespace Npgsql.Web.Blog.DataModel
{
public class BlogEntryCollection : List<BlogEntry>
{
}
}

View File

@ -0,0 +1,76 @@
using System;
using System.Configuration;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Npgsql.Web.Blog.DataModel
{
public class Comment
{
long id;
[DisplayName("Identifiant numérique de commentaire")]
public long Id {
get {
return id;
}
set {
id = value;
}
}
long postid;
[DisplayName("Identifiant numérique du billet commenté")]
public long PostId {
get {
return postid;
}
set {
postid = value;
}
}
/// <summary>
/// Gets or sets the author of this comment.
/// </summary>
/// <value>From.</value>
public string From { get; set; }
string content;
[DisplayName("Contenu")]
[Required(ErrorMessage = "S'il vous plait, saisissez un contenu")]
public string CommentText {
get {
return content;
}
set {
content = value;
}
}
public DateTime posted;
[DisplayName("Date de creation")]
public DateTime Posted {
get {
return posted;
}
set {
posted = value;
}
}
public DateTime modified;
[DisplayName("Date de modification")]
public DateTime Modified {
get {
return modified;
}
set {
modified = value;
}
}
public bool Visible { get; set ; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Configuration;
using System.Configuration.Provider;
using System.Collections.Generic;
namespace Npgsql.Web.Blog.DataModel
{
public enum FindBlogEntryFlags : byte {
MatchTitle = 1,
MatchContent = 2,
MatchUserName = 4,
MatchInvisible = 8
}
}

View File

@ -0,0 +1,340 @@
using System;
using System.Configuration;
using System.Configuration.Provider;
using Npgsql;
using Npgsql.Web.Blog.DataModel;
using System.Collections.Generic;
namespace Npgsql.Web.Blog
{
public class NpgsqlBlogProvider : BlogProvider
{
string applicationName;
string connectionString;
#region implemented abstract members of BlogProvider
public override long GetPostId (string username, string title)
{
throw new NotImplementedException ();
}
public override Comment[] GetComments (long postid, bool getHidden)
{
List<Comment> cmts = new List<Comment> ();
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "select _id, username, bcontent, modified, posted, visible from comment " +
"where applicationname = @appname and postid = @id" +
((getHidden) ? " and visible = true ":" ") +
"order by posted asc" ;
cmd.Parameters.Add ("@appname", applicationName);
cmd.Parameters.Add ("@id", postid);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
while (rdr.Read ()) {
Comment c = new Comment();
c.CommentText = rdr.GetString (rdr.GetOrdinal ("bcontent"));
c.From = rdr.GetString (rdr.GetOrdinal ("username"));
c.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
c.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
c.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
c.PostId = postid;
c.Id = rdr.GetInt64(rdr.GetOrdinal("_id"));
cmts.Add (c);
}
}
}
return cmts.ToArray();
}
public override void UpdatePost (long postid, string content, bool visible)
{
using (NpgsqlConnection cnx = new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
DateTime now = DateTime.Now;
cmd.CommandText =
"update blog set modified=@now, bcontent=@content, " +
"visible = @visible where _id = @id";
cmd.Parameters.Add ("@now", now);
cmd.Parameters.Add ("@content", content);
cmd.Parameters.Add ("@visible", visible);
cmd.Parameters.Add ("@id", postid);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close();
}
}
public override void RemovePost (long postid)
{
throw new NotImplementedException ();
}
public override long Comment (string from, long postid, string content)
{
if (from == null)
throw new ArgumentNullException("from");
if (content == null)
throw new ArgumentNullException("content");
bool visible = AutoValidateComment;
using (NpgsqlConnection cnx=
new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "insert into comment (postid,bcontent," +
"modified,posted,visible,username,applicationname)" +
"values (@postid,@bcontent,@modified,@posted," +
"@visible,@username,@appname) returning _id";
cmd.Parameters.Add ("@postid", postid);
cmd.Parameters.Add ("@bcontent", content);
DateTime now = DateTime.Now;
cmd.Parameters.Add ("@modified", now);
cmd.Parameters.Add ("@posted", now);
cmd.Parameters.Add ("@visible", visible);
cmd.Parameters.Add ("@username", from);
cmd.Parameters.Add ("@appname", applicationName);
cnx.Open ();
return (long) cmd.ExecuteScalar();
}
}
public override void ValidateComment (long cmtid)
{
throw new NotImplementedException ();
}
public override void UpdateComment
(long cmtid, string content, bool visible)
{
throw new NotImplementedException ();
}
private bool autoValidateComment = true;
public override bool AutoValidateComment {
get {
return autoValidateComment;
}
set {
autoValidateComment=value;
}
}
public override string BlogTitle
(string username)
{
throw new NotImplementedException ();
}
#endregion
public override void Initialize
(string name, System.Collections.Specialized.NameValueCollection config)
{
string cnxName = config ["connectionStringName"];
connectionString = ConfigurationManager.ConnectionStrings [cnxName].ConnectionString;
config.Remove ("connectionStringName");
applicationName = config ["applicationName"];
config.Remove ("applicationName");
defaultPageSize = int.Parse ( config ["pageLen"] ?? "10") ;
base.Initialize (name, config);
}
#region implemented abstract members of BlogProvider
public override BlogEntry GetPost (long postid)
{
BlogEntry be = null;
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "select username, title, bcontent, modified, posted, visible from blog " +
"where applicationname = @appname and _id = @id";
cmd.Parameters.Add ("@appname", applicationName);
cmd.Parameters.Add ("@id", postid);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
if (rdr.Read ()) {
be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.UserName = rdr.GetString (rdr.GetOrdinal ("username"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Id = postid;
}
}
}
return be;
}
public override long RemoveComment (long cmtid)
{
long postid = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from comment where _id = @id returning postid";
cmd.Parameters.Add ("id", cmtid);
cnx.Open ();
postid = (long) cmd.ExecuteScalar ();
}
return postid;
}
public override BlogEntry GetPost (string username, string title)
{
BlogEntry be = null;
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "select _id,bcontent,modified,posted,visible from blog " +
"where applicationname = @appname and username = @username and title = @title";
cmd.Parameters.Add ("@appname", applicationName);
cmd.Parameters.Add ("@username", username);
cmd.Parameters.Add ("@title", title);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
if (rdr.Read ()) {
be = new BlogEntry ();
be.Title = title;
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.UserName = username;
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
}
}
}
return be;
}
public override long Post (string username, string title, string content, bool visible)
{
if (username == null)
throw new ArgumentNullException("username");
if (title == null)
throw new ArgumentNullException("title");
if (content == null)
throw new ArgumentNullException("content");
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "insert into blog (title,bcontent,modified,posted,visible,username,applicationname)" +
"values (@title,@bcontent,@modified,@posted,@visible,@username,@appname) returning _id";
cmd.Parameters.Add ("@title", title);
cmd.Parameters.Add ("@bcontent", content);
DateTime now = DateTime.Now;
cmd.Parameters.Add ("@modified", now);
cmd.Parameters.Add ("@posted", now);
cmd.Parameters.Add ("@visible", visible);
cmd.Parameters.Add ("@username", username);
cmd.Parameters.Add ("@appname", applicationName);
cnx.Open ();
return (long) cmd.ExecuteScalar();
}
}
public override BlogEntryCollection FindPost (string pattern, FindBlogEntryFlags searchflags, int pageIndex, int pageSize, out int totalRecords)
{
BlogEntryCollection c = new BlogEntryCollection ();
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "select title,bcontent,modified,posted,username,visible from blog " +
"where applicationname = @appname";
cmd.Parameters.Add ("@appname", applicationName);
if ((searchflags & FindBlogEntryFlags.MatchContent) > 0) {
cmd.CommandText += " and bcontent like @bcontent";
cmd.Parameters.Add ("@bcontent", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchTitle) > 0) {
cmd.CommandText += " and title like @title";
cmd.Parameters.Add ("@title", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchUserName) > 0) {
cmd.CommandText += " and username like @username";
cmd.Parameters.Add ("@username", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchInvisible) == 0) {
cmd.CommandText += " and visible = true";
}
cmd.CommandText += " order by posted desc";
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
totalRecords = 0;
int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1;
while (rdr.Read()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.UserName = rdr.GetString (rdr.GetOrdinal ("username"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
c.Add (be);
}
totalRecords++;
}
}
}
return c;
}
public override void RemovePost (string username, string title)
{
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "delete from blog where username = @username and applicationname = @appname and title=@title";
cmd.Parameters.Add ("@username",username);
cmd.Parameters.Add ("@appname", applicationName);
cmd.Parameters.Add ("@title",title);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close();
}
}
int defaultPageSize = 10;
public override BlogEntryCollection LastPosts(int pageIndex, int pageSize, out int totalRecords)
{
BlogEntryCollection c = new BlogEntryCollection ();
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
/*cmd.CommandText = "select blog.* from blog, " +
"(select max(posted) lpost, username " +
"from blog where applicationname = @appname " +
"group by username) as lblog " +
"where blog.posted = lblog.lpost and blog.username = lblog.username " ;
*/
cmd.CommandText = "select * " +
"from blog where applicationname = @appname and visible = true " +
" order by posted desc limit @len" ;
cmd.Parameters.Add ("@appname", applicationName);
cmd.Parameters.Add ("@len", defaultPageSize);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
totalRecords = 0;
int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1;
while (rdr.Read()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
be.Content = rdr.GetString (rdr.GetOrdinal ("bcontent"));
be.UserName = rdr.GetString (rdr.GetOrdinal ("username"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Visible = true; // because of sql code used
c.Add (be);
}
totalRecords++;
}
}
}
return c;
}
#endregion
}
}

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Npgsql.Web.Blog</RootNamespace>
<AssemblyName>NpgsqlBlogProvider</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="Configuration\BlogProviderConfigurationElement.cs" />
<Compile Include="Configuration\BlogProvidersConfigurationCollection.cs" />
<Compile Include="Configuration\BlogProvidersConfigurationSection.cs" />
<Compile Include="DataModel\BlogEntry.cs" />
<Compile Include="DataModel\BlogEntryCollection.cs" />
<Compile Include="BlogHelper.cs" />
<Compile Include="BlogManager.cs" />
<Compile Include="BlogProvider.cs" />
<Compile Include="NpgsqlBlogProvider.cs" />
<Compile Include="DataModel\FindBlogEntryFlags.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="DataModel\Blog.cs" />
<Compile Include="DataModel\Comment.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataModel\" />
<Folder Include="Sql\" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="Npgsql" />
<Reference Include="System.Configuration" />
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedFlat" ResourceNamePolicy="FileFormatDefault" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<None Include="Sql\BlogTable.sql" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,21 @@
-- Table: blog
-- DROP TABLE blog;
CREATE TABLE blog
(
applicationname character varying(255) NOT NULL,
username character varying(255) NOT NULL,
posted timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
title character varying(255) NOT NULL,
bcontent text NOT NULL,
CONSTRAINT pk_blog PRIMARY KEY (username , applicationname , title ),
CONSTRAINT bloguser FOREIGN KEY (applicationname, username)
REFERENCES users (applicationname, username) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);