Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Aladdin committed Apr 19, 2017
1 parent 5b60563 commit c21611a
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 2 deletions.
80 changes: 79 additions & 1 deletion docs/Ref.InterfaceMetadata.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,80 @@
## InterfaceMetadata class
<span style="font-style: italic; color: silver;">This page is a work in progress.<span>

Represent interface information

### Declaration
```csharp
internal class InterfaceMetadata
{
private readonly Dictionary<ulong, PropertyMetadata> tblHashNames;

public Guid Id { get; set; }
public Type InterfaceType { get; set; }
public string Name { get; set; }
public Type Concrete { get; set; }
public List<PropertyMetadata> Properties { get; set; }
public List<InterfaceMetadata> Parents { get; set; }

public PropertyMetadata GetProperty(string name, bool ignoreCase);
public void UpdateMetadata();
}
```

### Methdos
```csharp
public PropertyMetadata GetProperty(string name, bool ignoreCase);
```
*Description*: retrieve property information by name.

`name`: property name.

`ignoreCase`: ignore character casing when searching for property.

```csharp
public void UpdateMetadata();
```
*Description*: this function populate `tblHashNames` field with all properties and their name hash for fast access.

### Properties
```csharp
public Guid Id { get; set; }
```
*Description*: interface id, from [`Type.GUID`](https://msdn.microsoft.com/en-us/library/system.type.guid(v=vs.110).aspx).

```csharp
public Type InterfaceType { get; set; }
```
*Description*: [`Type`](https://msdn.microsoft.com/en-us/library/system.type(v=vs.110).aspx) class for this interface.

```csharp
public string Name { get; set; }
```
*Description*: interface name.

```csharp
public Type Concrete { get; set; }
```
*Description*: concrete class [`type`](https://msdn.microsoft.com/en-us/library/system.type(v=vs.110).aspx) for this interface.

```csharp
public List<PropertyMetadata> Properties { get; set; }
```
*Description*: list of properties in this interface.

```csharp
public List<InterfaceMetadata> Parents { get; set; }
```
*Description*: list of interfaces that this interface implements.

## Fields
```csharp
private readonly Dictionary<ulong, PropertyMetadata> tblHashNames;
```
*Description*: provide fast access to properties using their name hash.


## Remarks

After the interface collect all information required then the function `UpdateMetadata` gets called to fill the hash table `tblHashNames` with properties twice, one with provided name, and another using lower case version.

The hash function is `CalculateHash` in `DataMap`.
63 changes: 62 additions & 1 deletion docs/Ref.PropertyMetadata.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,63 @@
## PropertyMetadata class
<span style="font-style: italic; color: silver;">This page is a work in progress.<span>

Encapsulate property information

### Declaration
```csharp
internal class PropertyMetadata
{
public string Name { get; set; }
public Type Type { get; set; }
public IList<string> Alias { get; set; }
public MethodInfo SetMethod { get; set; }
public MethodInfo GetMethod { get; set; }
public Action<object, object> SetValue { get; set; }
public Func<object, object> GetValue { get; set; }

internal void CreateFastGetSetMethod(Type interfaceType);
}
```

### Methdos
```csharp
internal void CreateFastGetSetMethod(Type interfaceType);
```
*Description*: create getter/setter functions for input interface and assign them to property `GetValue` and `SetValue`.

`interfaceType`: interface to create property setter and getter.

### Properties
```csharp
public string Name { get; set; }
```
*Description*: property name

```csharp
public Type Type { get; set; }
```
*Description*: property type

```csharp
public IList<string> Alias { get; set; }
```
*Description*: alias list used with property

```csharp
public MethodInfo SetMethod { get; set; }
```
*Description*: set method as returned from [`PropertyInfo.GetSetMethod()`](https://msdn.microsoft.com/en-us/library/scfx0019(v=vs.110).aspx)

```csharp
public MethodInfo GetMethod { get; set; }
```
*Description*: get method as returned from [`PropertyInfo.GetGetMethod()`](https://msdn.microsoft.com/en-us/library/e17dw503(v=vs.110).aspx)

```csharp
public Action<object, object> SetValue { get; set; }
```
*Description*: property setter created by `CreateFastGetSetMethod`.

```csharp
public Func<object, object> GetValue { get; set; }
```
*Description*: property getter created by `CreateFastGetSetMethod`.

0 comments on commit c21611a

Please sign in to comment.