Import dotnetDBF for error handling.

This commit is contained in:
Patrick Fic
2022-02-11 15:06:05 -08:00
parent 991ad38839
commit f32c149bae
75 changed files with 5585 additions and 7 deletions

View File

@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
// ReSharper disable StringLiteralTypo
// ReSharper disable IdentifierTypo
namespace DotNetDBF.Enumerable
{
/// <summary>
/// Interface to get the contents of the DBF Wrapper
/// </summary>
///
[Obsolete("DotNetDBF.Enumerable.IDBFInterceptor is the new interface name",error:true)]
public interface IDBFIntercepter:IDBFInterceptor
{
}
[Obsolete("DotNetDBF.Enumerable.DBFInterceptor is the new class name")]
public class DBFIntercepter : DBFEnumerable.DBFIntercepter
{
public DBFIntercepter(object[] wrappedObj, string[] fieldNames) : base(wrappedObj, fieldNames)
{
}
}
}
namespace DotNetDBF.Enumerable
{
public static partial class DBFEnumerable
{
[Obsolete("DotNetDBF.Enumerable.IDBFIntercepter is the new interface name")]
public interface IDBFIntercepter : DotNetDBF.Enumerable.IDBFIntercepter
{
}
[Obsolete("DotNetDBF.Enumerable.DBFIntercepter is the new class name")]
public class DBFIntercepter : DotNetDBF.Enumerable.Enuemrable.DBFIntercepter, IDBFIntercepter
{
public DBFIntercepter(object[] wrappedObj, string[] fieldNames)
: base(wrappedObj, fieldNames)
{
}
}
}
[Obsolete("DBFEnumerable is the new class name")]
public static class Enuemrable
{
/// <summary>
/// New Blank Row Dynamic object that matches writer;
/// </summary>
/// <param name="writer">The writer.</param>
/// <returns></returns>
public static dynamic NewBlankRow(DBFWriter writer)
{
return writer.NewBlankRow();
}
/// <summary>
/// Writes the record.
/// </summary>
/// <param name="writer">The writer.</param>
/// <param name="value">The value.</param>
public static void WriteRecord(DBFWriter writer, IDBFIntercepter value)
{
writer.WriteRecord(value);
}
/// <summary>
/// Adds the record.
/// </summary>
/// <param name="writer">The writer.</param>
/// <param name="value">The value.</param>
public static void AddRecord(DBFWriter writer, IDBFIntercepter value)
{
writer.AddRecord(writer, value);
}
/// <summary>
/// Return all the records. T should be interface with getter properties that match types and names of the database.
/// Optionally instead of T being and interface you can pass in an anonymous object with properties that match that
/// database and then you'll get an IEnumerable of that anonymous type with the data filled in.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="reader">The reader.</param>
/// <param name="prototype">The prototype. Anonymous class instance</param>
/// <returns></returns>
public static IEnumerable<T> AllRecords<T>(DBFReader reader, T prototype = null) where T : class
{
return reader.AllRecords(prototype);
}
/// <summary>
/// Returns a list of dynamic objects whose properties and types match up with that database name.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="whereColumn">The where column name.</param>
/// <param name="whereColumnEquals">What the were column should equal.</param>
/// <returns></returns>
public static IEnumerable<dynamic> DynamicAllRecords(DBFReader reader, string whereColumn = null,
dynamic whereColumnEquals = null)
{
return reader.DynamicAllRecords(whereColumn, (object) whereColumnEquals);
}
[Obsolete("DotNetDBF.Enumerable.IDBFIntercepter is the new interface name",error:true)]
public interface IDBFIntercepter : DotNetDBF.Enumerable.IDBFInterceptor
{
}
[Obsolete("DotNetDBF.Enumerable.DBFIntercepter is the new class name")]
public class DBFIntercepter : DotNetDBF.Enumerable.BaseDBFInterceptor, IDBFIntercepter
{
public DBFIntercepter(object[] wrappedObj, string[] fieldNames)
: base(wrappedObj, fieldNames)
{
}
}
}
}