P4.Net Overview

From P4dotnet

Jump to: navigation, search

Contents

Introduction

P4.Net is an API for the Microsoft .Net Common Language Runtime (CLR). It can be used from any managed language including C#, VB.Net, and J#.

  • Support for Framework versions 1.1 and 2.0.
  • Results can be streamed as "pre-parsed", and are abstracted to "Recordsets" and "Records".
  • Direct manipulation of forms (p4 client, branch, user, etc.).
  • Connections are auto-managed (no need to set "ParseForms" or "Tagged" like other APIs).
  • P4PendingChangelist object makes submitting changes a snap.

P4.Net vs. P4COM

P4COM can absolutely be used from managed languages w/o issues. So why would you want to use P4.Net? P4COM requires you to register the dll when deploying, but since P4.Net is entirely managed code, there is no need to register any dlls. You can literally use xcopy deployment (or p4 sync :-). Also, P4COM is constrained by some of the inherent limitations in COM. P4.Net uses inheritance, indexers and collection interfaces that all give it a cleaner, more .Net-like interface than P4COM (IMHO).

Obtaining P4.Net

P4.Net can be downloaded on the SourceForge download page. The distribution includes binaries, sample applications and a chm help file. Source code is maintained in the Perforce public depot: //guest/shawn_hladky/P4.Net http://www.msn.com/

Deploying P4.Net

Choose the appropriate binaries. They are available strong-named or not, and for the 1.1 and 2.0 framework. In the bin directory, sub-directories beginning with 'SN_' indicate the strong-named assemblies. Include the assemblies (p4dn.dll and p4api.dll) in the bin folder with your application, or install to the GAC.

Architecture

P4.Net is divided into two distinct components.

p4dn: Written in C++ (with Managed Extensions), this component marshals all objects between the native Perforce C++ API and managed types. It generally follows the object model of the native Perforce API. It was ported from Jacob Gladish's implementation in the Perforce public depot.

P4API: Written in C#, this component consumes p4dn, and abstracts the complexity of the native API into an easier to use interface. The object model is inspired from a combination P4Ruby, P4Python, P4COM, and ADO.

Personal tools