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
// http://www.codeproject.com/Tips/474296/Clone-an-Entity-in-Entity-Framework | |
// Static | |
public static T CopyEntity<T>(MyContext ctx, T entity, | |
bool copyKeys = false) where T : EntityObject | |
{ | |
T clone = ctx.CreateObject<T>(); | |
PropertyInfo[] pis = entity.GetType().GetProperties(); | |
foreach (PropertyInfo pi in pis) |
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
SELECT owner, table_name | |
FROM USER_CONSTRAINTS | |
WHERE constraint_name = 'CNTR_DTYP_FK' |
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
Install-Package log4mongo-net |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<configSections> | |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> | |
</configSections> | |
<log4net configSource="mongo_appender.config"/> | |
</configuration> |
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
<?xml version="1.0"?> | |
<log4net> | |
<appender name="MongoDBAppender" type="Log4Mongo.MongoDBAppender, Log4Mongo"> | |
<connectionString value="mongodb://localhost" /> | |
<collectionName value="logs" /> | |
<field> | |
<name value="timestamp" /> | |
<layout type="log4net.Layout.RawTimeStampLayout" /> | |
</field> | |
<field> |
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 Logger : ILogger | |
{ | |
private readonly ILog log; | |
public Logger(string type) | |
{ | |
this.log = LogManager.GetLogger(type); | |
} | |
public void Debug(object message) |
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 interface ILogger | |
{ | |
void Debug(object message); | |
void Debug(object message, Exception exception); | |
void Error(object message); | |
void Error(object message, Exception exception); | |
void Fatal(object message); | |
void Fatal(object message, Exception exception); |
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 HomeController : Controller | |
{ | |
private readonly ILogger logger; | |
public HomeController(ILogger logger) | |
{ | |
XmlConfigurator.Configure(); | |
this.logger = logger; | |
} |
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
mongod -–dbpath C:\data |
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
db.logs.find().pretty() |
OlderNewer