sfeldman.NET

.NET, code, personal thoughts

If you are into trance music, check armadamusic out.

Posted by Sean Feldman | with no comments
Filed under:

This is a good joke. As always, in every joke, there’s a lot of truth.

Posted by Sean Feldman | with no comments
Filed under:

The question came from my son… and he was right. There’s something wrong with it.

clock

Posted by Sean Feldman | 5 comment(s)
Filed under:
I just got rid of all old DVDs with interactive learning. Funny how fast technology becomes outdated, yet principles never change. I also stopped using interactive courses long time ago, as they become a bit useless – a contemporary tech. books, blogs and webinars are definitely enough to get your feet wet in new technologies. 

OLYMPUS DIGITAL CAMERA

Posted by Sean Feldman | with no comments
Filed under:

As a part of the build script I tend to generate AssemblyInfo.cs in order to inject assembly information dynamically, such as version, name, etc. One gotcha I ran into lately, is when you have internals that are testable and need to generate that information from NAnt as well.

Normally, the code in AssemblyInfo.cs wood look like this:

[assembly: InternalsVisibleTo("Project.Test")]

NAnt fails. Reason - NAnt is requires full class name, which is InternalsVisibleToAttribute, so that the line of code showed above looks like this:

[assembly: InternalsVisibleToAttribute("Project.Test")]
Posted by Sean Feldman | with no comments
Filed under: ,

Each time we use NHibernate, we have to share production and semi-production code for NHibernate SessionFactory. Production code is the portion that is actually responsible to generate the SessionFactory on startup. Semi-production code, is the code that generates SessionFactory for purpose of schema extraction (SQL statements we use to generate DB). This time around, the smell had to be removed. Having identical code duplicated not only risky, but also becomes intolerable once it grows beyond a single line. This is our new SessionBuilder, that leverages the same code to generate SessionFactory for run-time purpose and schema generation at “design” time.

private static ISessionFactory sessionFactory;
private ISession session;
 
public ISession GetSession()
{
  Initialize();
  if (session == null)
    session = sessionFactory.OpenSession();
 
  return session;
}
 
public void CloseSession()
{
  if (session.IsNull())
    return;
 
  session.Close();
  session.Dispose();
  session = null;
}
 
private static void Initialize()
{
  if (sessionFactory.IsNull())
    sessionFactory = GetProjectNHibernateConfiguraton().BuildSessionFactory();
}
 
private static FluentConfiguration GetProjectNHibernateConfiguraton()
{
  var nhibernateConfiguration = new Configuration().Configure();
 
  var model = AutoMap.AssemblyOf<Entity>().IgnoreBase<Entity>()
    .Where(type => typeof (Entity).IsAssignableFrom(type))
    .Conventions.AddFromAssemblyOf<Entity>()
    .UseOverridesFromAssemblyOf<Entity>();
 
  return Fluently.Configure(nhibernateConfiguration)
    .Mappings(mappingConfiguration => mappingConfiguration.AutoMappings.Add(model));
}
 
#region Manually used to generate DB schema SQL scripts
 

internal static string DROP_SCHEMA_SQL_SCRIPT_NAME =

new FileInfo(Path.Combine(Path.GetTempPath(), "Schema_Drop.sql")).FullName;

internal static string CREATE_SCHEMA_SQL_SCRIPT_NAME =

new FileInfo(Path.Combine(Path.GetTempPath(), "Schema_Create.sql")).FullName;

 
/// <summary>Use TestDriven.Net to run this method as a test to generate SQL scripts and their files.</summary>
internal static void Generate_Database_Schema_and_Create_SQL_script_files()
{
  GetProjectNHibernateConfiguraton()
    .ExposeConfiguration(SchemaGenerator)
    .BuildSessionFactory();
}
 
private static void SchemaGenerator(Configuration configuration)
{
  var schemaExport = new SchemaExport(configuration);
  schemaExport.SetOutputFile(DROP_SCHEMA_SQL_SCRIPT_NAME).Drop(true, false);
  schemaExport.SetOutputFile(CREATE_SCHEMA_SQL_SCRIPT_NAME).Create(true, false);
}
 
#endregion

Region represents the “design-time” code. And I was using Fluent NHibernate with auto-mapping to generate the entities.

Posted by Sean Feldman | 2 comment(s)
Filed under:

We got two good developers applied and accepted to the company from what it looks through my blog. I have posted about 2 weeks ago that we are looking for developers. This is great! We need more people. Same call is still active.

Oh, and it tells me someone out there is actually reading the blog :)

Posted by Sean Feldman | with no comments
Filed under:

I like the idea of being able to copy something and paste it on the net. It’s handy, no registration is required, and it’s temporary, just as clipboard supposed to be.

I use imbPlace.com for images. Does anyone knows similar service for C# code snippets?

Posted by Sean Feldman | 1 comment(s)
Filed under:

Another case of creativity that makes you smile.

And well, for every good start, there’s more to come :D

Posted by Sean Feldman | 2 comment(s)
Filed under:

Looking for help. I am trying to select a good .NET obfuscator tool that has to be:

  1. Free
  2. Supported (still developed)
  3. Work well with command line (for automated build script)
  4. Be flexible enough (configurable for options)

Right now Babel Obfuscator looks good. My decision was based on analysis of possible tools listed on this wiki. In case you have some input that can help me to do a better choice, feel free to leave comments. Appreciated.

Posted by Sean Feldman | 7 comment(s)
Filed under:
More Posts Next page »